A Python (3.6+) implementation of the Lox language, from the in-progress book Crafting Interpreters by Bob Nystrom.
This project is a port of jlox, the Java-based implementation presented throughout part of the book.
Lox is a full-featured, object-oriented scripting language with dynamic typing, garbage collection, lexical scope, first-class functions, closures, classes and inheritance, and more.
This implementation is still ongoing, and there is a desire to extend the project later for educational purposes.
At the moment, the implementation follows almost every step and decision in the book, however:
- Not all challenges have been implemented yet.
- I'll be using
null
instead ofnil
. - I will try to handle both
int
andfloat
numbers. - The
TokenType
enum has many more tokens and keywords than those described by the book. I recorded all the ideas that came to mind while reading the language planning section.
The only requirement to run this project is Python 3.6+, due to the type hints used almost everywhere.
This project was developed on OS X, but it should work on any OS without any problems.
python -m lox
Enter exit
or press Ctrl+D to leave.
python -m lox path/to/file
MIT License