This project aims to implement an RPAL interpreter in Python. The interpreter will be able to parse RPAL code, build an abstract syntax tree (AST), and execute the RPAL program.
- Lexical analysis of RPAL code
- Parsing RPAL code to build an abstract syntax tree (AST)
- Interpreting and executing RPAL programs
- Support for variable bindings, function definitions, conditionals, and recursion
Navigate to the /src directory of the project.
To run the program, use the following command:
python myrpal.py filenamewhere filename is the name of the file containing the RPAL code.
to print the abstract syntax tree, add the -ast flag at the end of the command
python myrpal.py filename -astto print the standardized tree, add the -st flag at the end of the command
python myrpal.py filename -stIn Linux, run the command by replacing python with python3
To run the tests, navigate to the /src of the project and use the following commands.
# lexer tests
python -m unittest tests/test_lexer.py
# parser tests
python -m unittest tests/test_parser.py
python -m unittest tests/test_rpal_parser.py
# ...
# all
python -m unittest discover -s tests -p 'test_*.py'Documentation can be found at https://rajivapavan.github.io/rpal-project/
Documentation is built using Sphinx.
To build the documentation, enable the virtual environment
python -m venv venv ; .\venv\Scripts\Activateinstall the required packages
pip install -r requirements.txtFrom the root directory of the project, run the following commands:
cd docs
sphinx-apidoc -o . ../src
./make html # or whatever format you wantto find list of available formats, run
./make