Pylox is a Lox interpreter, implemented in Python, based on the book Crafting Interpreters by Bob Nystrom.
I am currently working through Chapter 9.
Also, I have implemented some of the chapter challenges so far, but not all. Eventually I want to 100% the Tree-Walk Interpreter section
Table of Contents
Useful for debugging
Pull from Github
Requires Python 3.10 or later
I use Hatch to manage the Python environment
Ch 4. Scanning
- Support for C-style block comments (NOT nestable)
Ch 5. Representing Code
- AST print Reverse Polish Notation
Ch 6. Parsing Expressions
- Comma Operator
- Ternary Operator
- Error productions for binary operators without left-hand side expression
Ch 7. Evaluating Expressions
- []
define "+" so that if one operand is string, it coerces other operand to stringI don't really like this behaviour with strings. Between floats and ints this is okay, but Lox anyways only has float type - handle zero division error
Ch 8. Statements and State
- Evaulate expressions in REPL
- Runtime error when accessing uninitialized variables
Ch 9. Control Flow
cli: handles command line interface (cli) options, cli formatting, stdin/stdout.
utils: helper utilities; not particularly significant to the function of the app, but convenient.
engine: the core of the pylox interpreter
pylox
is distributed under the terms of the MIT license.