An Experimental Programming Language written Python. It uses Top Down Operator Precedence aka, Pratt Parser for parsing.
This project should only be used for educational purposes
Source code split into three files:
lexer.py
generates tokens ready for parsingparse_tree.py
generates parse_treeinterpreter.py
interprets the tree
Main focus of the project is parse_tree.py
because this project is essentially an implementation of TDOP Algorithm.
The interpreter code is realy simple. Actualy just one function. (in interperter.py
)
In the test-code
file, there are many examples. Syntax is very similar to python. Code can be used as:
python3 interpreter.py test-code/{file_name}
This language implementation can be used for educational purposes. The code can be very simple however for realy understanding the parser algorithm look at the Fredrik Lundh's implementation. He does not implements the interpreter but you can check mine for it.
Fredrik Lundh's implementation
Douglas Crockford's implementation. Uses javascript however the algorithm is the same.