👻 | Rust version of the Lox interpreter
This repository contains a Rust implementation of the Lox interpreter, a language introduced in the book "Crafting Interpreters" by Robert Nystrom. The interpreter supports various features of the Lox language, including variables, expressions, and control flow.
.gitignore
Cargo.lock
Cargo.toml
examples/
environment.lox
logical.lox
print.lox
unary.lox
variables.lox
src/
environment.rs
expression.rs
interpreter.rs
lib.rs
literal.rs
main.rs
parser.rs
scanner.rs
statement.rs
token_kind.rs
token.rs
target/
tests/
binary_op.rs
examples/: Contains example Lox programs.
src/: Contains the source code for the Lox interpreter.
tests/: Contains unit tests for the interpreter.
- Rust (latest stable version)
To build the project, run:
cargo build
You can run the interpreter with a Lox file:
cargo run examples/print.lox
Or start a REPL:
cargo run
To run the tests, use:
cargo test
You can find example Lox programs in the examples directory. For instance, to run the print.lox example:
cargo run -- examples/print.lox
This project is licensed under the MIT License. See the LICENSE file for details.