13 Commits

Author SHA1 Message Date
bb58b17528
fix: Fixed typo in keyword and added missing do and typename keywords
Signed-off-by: erick-alcachofa <erick@artichoke.dev>
2025-10-04 10:35:03 -06:00
e1b9e054f3
feat(test, tokenizer): Add test suite, in Tokenizer fixed catched issues and range-based API
Signed-off-by: erick-alcachofa <erick@artichoke.dev>

This commit introduces a comprehensive test suite for the tokenizer
using the Catch2 framework. To support this and improve the project
structure, the build system and the tokenizer's API have been
significantly updated.

- Removed `cmake/testing.cmake` as it's no longer needed.
- A new `TokenizerRange` class provides a C++20-style range interface,
  allowing for simple `for-each` loop iteration over tokens. This is
  used extensively in the new tests.

- The CMake build system has been refactored:
    - An `ENABLE_TESTING` option (OFF by default) now controls whether
      the test suite is built.
    - The core library is now compiled into an object library, which is
      then used to produce both a shared (`.so`/`.dll`) and a static
      (`.a`/`.lib`) library. This improves build efficiency and provides
      more flexible linkage options.
    - The frontend executable now links against the static version of
      the library.

- Implemented tests for tokenizer using Catch2 framework, covering
  various cases like identifiers, keywords, numbers, etc. that already
  catched some issues in current implementation.

- Several parsing bugs and edge cases in the tokenizer were fixed,
  including the handling of unterminated strings and invalid numeric
  literals. The README has been updated with instructions for building
  and running tests.
2025-10-03 12:54:41 -06:00
0f8688d3ee
fix: Fix install path in library CMakeLists.txt
Signed-off-by: erick-alcachofa <erick@artichoke.dev>
2025-10-02 23:45:04 -06:00
db29d1f8ba
chore: Fix wiki link in readme
Signed-off-by: erick-alcachofa <erick@artichoke.dev>
2025-10-02 00:28:12 -06:00
f3cc5b90c8
chore: Fix naming of wiki source file
Signed-off-by: erick-alcachofa <erick@artichoke.dev>
2025-10-02 00:26:35 -06:00
bce60cfef8
chore: Updated readme
Signed-off-by: erick-alcachofa <erick@artichoke.dev>
2025-10-01 23:39:32 -06:00
e024c03134
chore: Removed unnecessary bold in titles
Signed-off-by: erick-alcachofa <erick@artichoke.dev>
2025-10-01 23:39:17 -06:00
d0599d374f
feat: Add language grammar and adjusted tokenizer
Signed-off-by: erick-alcachofa <erick@artichoke.dev>

This commit lays the foundational groundwork for the artichoke language
parser by introducing the formal language grammar specification.

The tokenizer was updated to include new operators and keywords, also
added the posibility to handle comments.

Key Additions:
- Implemented support for C-style block comments (`/* ... */`),
  including error handling for unclosed comments.
- Added all necessary tokens for missing keywords (e.g., `module`,
  `export`, `using`, `match`, `loop`) and operators (e.g., `+=`, `:=`,
  `.#`, `.*`, `.@`).
- The `Token` enum has been expanded to reflect the full language
  feature set.

Documentation:
- Added `docs/grammar.ebnf` which contains the official, well-structured
  EBNF grammar for the language.
- Added `docs/readme.md` providing a detailed technical overview of the
  language's features, syntax, and semantics.

BREAKING CHANGE: The `kwVariant` and `kwMut` tokens have been removed to
align with the updated language design defined in the new grammar.
2025-10-01 18:51:09 -06:00
f9051e1c21
fix: Minor fixes
Fixed some minor mistakes (wrong messages/errors) due to copy/pasting
code.

Fixed that digits weren't allowed in identifiers before.

Also minor improvements in some functions/code parts.
2025-06-30 00:31:10 -06:00
85dd8bc10f
chore: Added compile warnings
Enabled compilation warnings and solved compilation problems.

TODO: Is it correct to have the warnings `hard-coded` on the CMakeFiles?
2025-05-10 21:07:49 -06:00
85a34bdd65
feat: Added Token, Tokenizer, Generator, and some utilities
Initial version of Tokenizer and Token
Generator template for coroutines (used in tokenizer)
Utilities like string related functions, TrieMap, and error handling

TODO: Add tests for Tokenizer
TODO: Add tests for Generator
2025-03-10 01:20:23 -06:00
0f4474821d
chore: Added CMake project setup
Added CMake files to set up project build, also added the file tree
structure of the project and clangd related settings
2025-03-04 12:50:53 -06:00
0f68b149da
chore: Initial commit
Initial commit for repo, added .gitignore, LICENSE, NOTICE and README.md
files
2025-03-01 01:27:46 -06:00