Skip to content
/ lox Public

A dart implementation of Bob Nystrom's Lox language

License

Notifications You must be signed in to change notification settings

sma/lox

Repository files navigation

Lox implemented in Dart

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.

Note

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

About

A dart implementation of Bob Nystrom's Lox language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages