Skip to content

A python-based interpreter for the Right-reference Pedagogic Algorithmic Language (RPAL), featuring a lexical analyzer, parser, standardizer, and CSE machine.

Notifications You must be signed in to change notification settings

vinukab/RPAL-Interpreter

Repository files navigation

🚀 RPAL Interpreter

This is an interpreter for the functional programming language RPAL, consisting of a lexical analyzer, parser, standardizer, and CSE machine.

⚙️ Setup

Before running the scripts, please follow these setup instructions:

  1. Clone the repository to your local machine.

  2. Install Python (if not already installed). You can download Python from here.

  3. Install make if you plan to use the provided Makefile:

    • Windows: Install via Chocolatey using the command:
    choco install make
    • Linux/macOS: make is usually pre-installed; if not, install it via your package manager (e.g., sudo apt-get install make).
  4. No additional Python packages are required to install. The project uses only built-in Python libraries.

📖 User Guide

1. Usage with Makefile 🔨

The Makefile provides different targets to run the script with different options.

🎯 Printing Final Output

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

🌳 Printing Abstract Syntax Tree(AST)

To print only the Abstract Syntax Tree (AST), use the ast target.

make ast file=path/to/your/input.txt

🧾 Printing Standardized Abstract Syntax Tree(SAST)

To print only the standardized Abstract Syntax Tree (ST), use the st target.

make st file=path/to/your/input.txt

2. Usage with Direct Python Commands 🐍

You can also run the scripts directly using the python command with the appropriate switches.

🎯 Printing Final Output

python myrpal.py path/to/your/input.txt

🌳 Printing Abstract Syntax Tree(AST)

python myrpal.py -ast path/to/your/input.txt 

🧾 Printing Standardized Abstract Syntax Tree(SAST)

python myrpal.py -st path/to/your/input.txt 

⚠️ Troubleshooting

🐍 Python was not found

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.

🔍 File Not Found

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.

❌ Make Command Not Found

If you get an error saying make is not found, it means make is not installed or not added to your system’s PATH.

About

A python-based interpreter for the Right-reference Pedagogic Algorithmic Language (RPAL), featuring a lexical analyzer, parser, standardizer, and CSE machine.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •