A custom programming language interpreter written in Rust.
This project is a simple interpreter for a custom programming language. It features a lexer, parser, and an interpreter that evaluates the abstract syntax tree (AST).
Frontend:
src: String --[lexing]--> token --[parsing]--> program<statement<expression>>
Runtime:
runtime.evaluate(program)
- Rust and Cargo must be installed on your system.
To build the project, run the following command in the root directory:
cargo buildThe interpreter can be run in two modes:
-
Shell Mode: To start the interactive shell, run:
cargo run -- shell
You can then enter expressions at the prompt. To exit the shell, type
exit. -
File Mode: To execute a script file, run:
cargo run -- <file_path>
Replace
<file_path>with the path to your script file.
The language supports basic expressions. Here is an example of what you can do in the shell:
> 1 + 2
NumberValue(3)