This is an interpreter for the functional programming language RPAL, consisting of a lexical analyzer, parser, standardizer, and CSE machine.
Before running the scripts, please follow these setup instructions:
-
Clone the repository to your local machine.
-
Install Python (if not already installed). You can download Python from here.
-
Install
makeif you plan to use the provided Makefile:- Windows: Install via Chocolatey using the command:
choco install make
- Linux/macOS:
makeis usually pre-installed; if not, install it via your package manager (e.g.,sudo apt-get install make).
-
No additional Python packages are required to install. The project uses only built-in Python libraries.
The Makefile provides different targets to run the script with different options.
To run the RPAL program and print the final output, use the run target. You need to specify the path to the test file using the file variable
make run file=path/to/your/test.txt
Example:
make run file=Tests/t1.txt
To print only the Abstract Syntax Tree (AST), use the ast target.
make ast file=path/to/your/input.txt
To print only the standardized Abstract Syntax Tree (ST), use the st target.
make st file=path/to/your/input.txt
You can also run the scripts directly using the python command with the appropriate switches.
python myrpal.py path/to/your/input.txt
python myrpal.py -ast path/to/your/input.txt
python myrpal.py -st path/to/your/input.txt
If you encounter an error stating that Python was not found, please ensure that Python is installed on your system and that it is added to your system's PATH environment variable.
If you are using the commannd as python try using python3. Some Linux distributions use python3 instead of python.
If the input file specified in the command is not found, double-check the path to the file. Ensure that the path is correct and the file exists.
If you get an error saying make is not found, it means make is not installed or not added to your system’s PATH.