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.
85 lines
2.9 KiB
Markdown
85 lines
2.9 KiB
Markdown
> :warning: WIP Highly Experimental Project
|
|
> * The language, compiler, and tools are under active development and may be
|
|
> very unstable.
|
|
> * There will likely be breaking changes and periods where no work is done on
|
|
> the project.
|
|
|
|
# The `artichoke` Programming Language
|
|
|
|
`artichoke` is a modern, statically-typed programming language designed to
|
|
satisfy my personal preferences and requirements for programming, combining the
|
|
low-level control and powerful modern features like a robust type system,
|
|
generics, integrated error handling, and a clean, ergonomic syntax.
|
|
|
|
The goal of `artichoke` is to provide a language that is simple, safe, and
|
|
productive for programming, eliminating common pitfalls without sacrificing
|
|
performance or control.
|
|
|
|
For a detailed guide to the language, please see the
|
|
[project wiki](https://git.artichoke.dev/me/artichoke-lang/wiki).
|
|
|
|
## Core Philosophy & Features
|
|
|
|
`artichoke` is built around a few core principles to create a safer, more
|
|
productive programming experience:
|
|
|
|
* **Explicitness:** Type conversions and error handling are explicit.
|
|
* **Safety:** Non-nullable pointers, a robust type system, and deterministic
|
|
resource management are prioritized.
|
|
* **Modern Ergonomics:** Features like generics, defer, and a clean module
|
|
system reduce boilerplate and improve readability.
|
|
|
|
The language includes a powerful **generic type system**, first-class **error
|
|
handling**, a full suite of **control flow** statements (including match), a
|
|
true **module system**, and **compile-time reflection**.
|
|
|
|
## Project Status
|
|
|
|
`artichoke` is currently in the ***design and grammar-specification phase***. The
|
|
grammar is stable, and the next step is the implementation of a compiler
|
|
(parser, semantic analyzer, and code generator).
|
|
|
|
## Building from Source
|
|
|
|
```bash
|
|
# Get the source code
|
|
git clone https://git.artichoke.dev/me/artichoke-lang.git
|
|
|
|
# Configure cmake
|
|
# Optionally add -DENABLE_TESTING=ON for building tests
|
|
cmake -DCMAKE_BUILD_TYPE=Release -S . -B build
|
|
|
|
# Build the project
|
|
cmake --build build
|
|
|
|
# Run the binary
|
|
./build/frontend/artichoke-c
|
|
|
|
# Run the tests if enabled
|
|
ctest --test-dir build/tests --output-on-failure
|
|
|
|
# Install if wanted
|
|
cmake --install build --prefix=/usr/local
|
|
|
|
# Run the installed binary
|
|
arti-c
|
|
```
|
|
|
|
## Contributing
|
|
|
|
The `artichoke` project is hosted on a personal, self-hosted Gitea instance. If
|
|
you are interested in contributing, you have two options:
|
|
|
|
1. **Request an Account:** Please contact support@artichoke.dev to request an
|
|
account on the Gitea instance.
|
|
2. **Submit Patches:** Alternatively, you can send patches or diffs directly to
|
|
the same email address.
|
|
|
|
In all cases, proper attribution will be given for your contributions in the
|
|
source files and/or the project wiki.
|
|
|
|
## License
|
|
|
|
This project is licensed under the **GNU Affero General Public License v3.0**.
|
|
The full license text can be found in the LICENSE file in this repository.
|