Minimal interpreter for a small university language implemented with PLY (lex/yacc).
Prerequisites
- pip install ply
Quick start
-
Install dependency: pip install ply
-
Run the interpreter on a source file: python interpreter.py test_cases\variables.txt
Included test cases (examples)
- test_cases\variables.txt
- test_cases\structs.txt
- test_cases\expressions.txt
- test_cases\standard_output.txt
Notes
- The interpreter script constructs the lexer and parser from the
lexer.pyandparser.pymodules. - If you edit grammar or parser code and want PLY to regenerate tables, remove
parsetab.py(it will be recreated) or setwrite_tables=Truein yacc call. - Usage: python interpreter.py