RCode is a simple programming language interpreter built in Rust. This project showcases the implementation of a basic interpreter with lexical analysis, parsing, and evaluation.
This project is a Rust-based interpreter for a custom language, RCode. It includes components for tokenization, parsing, and evaluating expressions. The interpreter can read source code from .pr
files, parse them into an abstract syntax tree (AST), and evaluate the expressions.
- Lexical analysis and tokenization
- Expression parsing with basic arithmetic operations
- Evaluation of expressions with runtime error handling
To get started with RCode, you need to have Rust installed on your machine. You can download and install Rust from rust-lang.org.
- Rust (installed via rustup)
- A text editor or IDE (optional, but recommended)
-
Clone the repository:
git clone https://github.com/yourusername/rcode-interpreter.git cd rcode-interpreter
-
Build the project:
cargo build
-
Run the interpreter with a
.pr
file:cargo run <path to .pr file>
Example:
cargo run examples/add.pr
Here is an example .pr
file to test the interpreter:
let x = 5;
let y = 10;
print(x + y);