A Dart port of Bob Nystrom Lox interpreter from his book Crafting Interpreters.
When Bob started his book, Java might have been a good choice but time flies and because Bob is working on Dart, it was fun to port all the Java code to Dart.
I made roughly one commit per chapter, so in theory you can follow along by checking out the code commit by commit. I tried to stay as close as possible to the Java source even if this means that the result isn't ideomatic. Still, the result is a bit shorter and IMHO more distinct.
Have fun.
To recreate ast.dart
, expr.dart
, and stmt.dart
, run
dart run :generate_ast lib
To launch the Lox REPL, run
dart run
To see a simple example, run
echo "print(3+4);" | dart run
To run the included example *.lox
files, run
for i in *.lox; do dart run :lox $i; done