An (incredibly bare bones) Python 3.9.2 interpreter implementation of the lox
programming language, adapted from the jlox tree-walk interpeter in the book
"Crafting Interpreters" by Robert Nystrom.
I put "bare bones" because currently the interpreter only supports a few of
lox's basic features so far:
- Literals (strings, floats)
- Basic Arithmetic (+, -, *, /)
- Boolean Arithmetic & Equality
- Expressions
- Statements (only
print
&var
) - Variable Declaration
- Variable Assignment
- Comments (single & multi-line)
- Block Statements & Scope
- If/Else Statements
- While Loops
I plan on adding more as I progress through the book
- This project assumes you have already installed python 3.9.2, if not you can download it here for Windows (64-bit) or grab other builds here
- Download this project's latest release here
- Unzip and extract
Downloads/Python-Lox-1.0.0.zip
- Open the
Windows PowerShell
app using the Start menu - Run the script by typing in the following format:
python3 src/main.py *.lox
For example, if you want to run the fizzbuzz.lox
script you can type in the following command:
python3 src/main.py examples/fizzbuzz.lox
- This project assumes you have already installed python 3.9.2, if not you can
download it here for MacOS
or grab other builds here
- You might need to install Apple's Developer Tools if you haven't already
- Download this project's latest release here
- Unzip and extract
Downloads/Python-Lox-1.0.0.zip
- Open the
Terminal
app through Launchpad - Use
cd
to change to the project's directory - Run the script by typing in the following format:
python3 src/main.py *.lox
For example, if you want to run the fizzbuzz.lox
script you can type in the following command:
python3 src/main.py examples/fizzbuzz.lox
- This project assumes you have already installed python 3.9.2, if not you can
run
sudo apt install python3.9
- Download this project's latest release here
- Run
unzip Downloads/Python-Lox-1.0.0.zip
- Use
cd
to change to the project's directory - Run the script by typing in the following format:
python3 src/main.py *.lox
For example, if you want to run the fizzbuzz.lox
script you can type in the following command:
python3 src/main.py examples/fizzbuzz.lox
This Project is licensed under the MIT License
Huge thank you to Bob Nystrom for letting me dive
into the monstrosity that is compiler/interpreter programming with Crafting Interpreters