TinyPy is an interpreter of a small Python subset I have written as a coursework.
This project uses ANTLR4 as a parser generator. To run the interpreter, you will need to install ANTLR4 Python3 runtime and ANTLR itself.
Please note, that 4.5.2 runtime has a bug which results in a dramatic performance dropdown. At the moment this text was written, pypi had an older version, so it's recommended to install ANTLR4 runtime manually.
Step-by-step instruction:
-
Install ANTLR4
-
Install ANTLR4 Python3 runtime:
git clone https://github.com/antlr/antlr4
cd antlr4/runtime/Python3
python3 setup.py install
It's also possible to use pip, package name is
antlr4-python3-runtime
. Be aware of the bug described above. -
Generate parser
- cd
tiny-py-interpreter/tinypy
antlr4 -visitor parser/TinyPy.g4
- cd
-
Install tinypy:
pip3 install .
-
Try to launch some tests:
python3 setup.py test