Losk is the educational lox interpreter (and VM) implementation from the book
Crafting Compilers. The VM is pretty complete at this moment as it has been
given enough care to pass all the tests from the original repo.
The interpreter might have some issues, and a major one being that it's possible to create cycle between objects
as Rc
is used liberally to represent pointers. I have no intention to refine the interpreter and only interested in
the VM.
assets/
- All the static files used in the project, mainly just benchmark photos.interpreter/
- Interpreter crate that should resemblejlox
from the book.losk-core/
- The core crate that is used by both the interpreter and the VM. As a side not, I named itcore
at the beginning but found that the name interferes with Rust in weird ways.scripts/
- This is where I store my files for generating plots.tests/
- The test suite from the source repository, with.out
expected outputs in.out
.vm/
- VM crate aka Rust version ofclox
Both the interpreter/
and vm/
folders contain TODOS.md
files where I dumped the challenges I'm interested in exploring
from the textbooks, plus a few todos that I think would improve the code in someway. But as you already know, the TODOs
are unlikely to be completed and that's why they are called TODOs, heh.
If you want to compare the performance between versions, I have translated the benchmark programs to python and documented them in BENCHMARK.md. You can find every optimization I have done in that file as well. The file also include benchmarks of the unsafe but more performant version which is much closer to clox.