Fox is a fast Lox interpreter written in rust based from the specifications in the Lox programming language by Robert Nystrom. Lox is known as a dynamic scripting language but with some OOP aspects like classes and inheritance. Imports are not included in this interpreter, however it's easy to add given the structure of the code.
- High Performance Lexer and Parser (Index-based AST similar to zig)
- Stack-based Bytecode VM
- Evaluating expressions
- Useful Error Messages
- Global and Local variable declaration
- Scoping
- Conditional statements
- For and While statements
- Functions
- Classes & OOP
- REPL
- Clone this repository.
- Install the rust toolchain version
1.88.0. - Build the projcet with
cargo buildor if you are in release mode,cargo build --release. - Run the interpreter with either the following subcommands depending on the output that you want:
tokenize(lexer),parse(parser),evaluate(evaluator), orrun(run with bytecode VM).cargo run <subcommand> <file_name>.
While this is a working interpreter at the moment, I wanted to finish it as a usable complete day-to-day interpreter that you would actually use. Providing a good developer experience is key to a good interpreter. Some features that I will definitely implement are pretty error messages, interactive REPL, and maybe in the future an LSP server with treesitter.
