Skip to content
implementations of the lox language as described at
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.


# lox

implementations of the lox language, as described at

## status

The tree-walking interpreter is complete (but without classes). the semantics
differ from lox, in that all variables store entire values, and assignment
always copies. this is due to the internal representation, which uses Clone
for all assignments and closures. This should change, but I'm not sure how to
manage memory or multiple references to the same value yet without needing to
write a garbage collector or wrap everything in an Rc<RefCell> -- or make all
values immutable, so that only Rc<> is necessary. Might come
back to this after writing the Intcode compiler. Unfortunately this means that
recursion isn't possible yet, since we can't get an environment when defining
a functiont that would have a reference to itself (because all bindings are
by value).

Compiler status: Implementation not yet begun. The Intcode VM is imported and
working and can handle running programs and writing to stdout; input isn't
working yet.

## usage

to run the interpreter in interactive mode:

    cargo run --bin interpreter

to run a script:

    cargo run --bin interpreter examples/hello.lox
You can’t perform that action at this time.