Yet another Lox interpreter.
>> print lox();
,--,
,---.'| ,----..
| | : / / \ ,--, ,--,
: : | / . : |'. \ / .`|
| ' : . / ;. \; \ `\ /' / ;
; ; ' . ; / ` ;`. \ / / .'
' | |__ ; | ; \ ; | \ \/ / ./
| | :.'|| : | ; | ' \ \.' /
' : ;. | ' ' ' : \ ; ;
| | ./ ' ; \; / | / \ \ \
; : ; \ \ ', / ; /\ \ \
| ,/ ; : / ./__; \ ; \
'---' \ \ .' | : / \ \ ;
`---` ; |/ \ ' |
`---' `--`
>> print 1+1;
2
>> print clock();
1668899599.0131063
>>
This is just for myself to learn Rust while reading the book "Crafting Interpreters" by Robert Nystrom.
# start a REPL
cargo run
# or run a Lox file (-r for release mode)
cargo run -- path/to/foobar.lox
# run tests
cargo test
- Current implementation handles errors slightly differently from the Java version
- No optimizations have been done and the performance is not great