Skip to content

maxArturo/lox-rs

Repository files navigation

lox-rs

A quick n dirty implementation of the Lox language, according to the book Crafting Interpreters in rust.

However, this doesn't mean its quick (compilers certainly aren't!) or dirty (Rust won't allow it, and also all the tests according to Munificent's spec pass). This is my cutting-teeth intro to Rust, from real code and first principles. All omissions and errors are mine.

The code samples (which are also e2e tests) are located here. There are examples of both valid and invalid lox code.

You can see a list of TODOs as well.

running a single lox file

cargo run -- ./loxrs_interpreter/src/lox/interpreter/test/e2e/unimplemented/basic_class.lox

Performance

Running the loxrs_interpreter/src/lox/interpreter/test/e2e/spec/benchmark/fib.lox on the release build of the treewalk interpreter on a 2.6 GHz 6-Core Intel Core i7 outputs:

==> true
==> 189.5220010280609

The bytecode interpreter ought to be much faster.

About

Interpreter for the Lox language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages