A comprehensive interpreter for the RPAL programming language, featuring lexical analysis, syntax parsing, AST/ST visualization, and semantic evaluation.
Developed by Team Atlantis ๐
- Overview
- Features
- Prerequisites
- Installation
- Usage
- Project Structure
- Build Methods
- Examples
- Contributing
- License
This RPAL interpreter is a complete implementation that processes RPAL (Right-reference Pedagogical Algorithmic Language) source code through multiple phases:
- Lexical Analysis - Tokenizes the input source code
- Syntax Parsing - Builds Abstract Syntax Trees (AST)
- Tree Standardization - Converts AST to Standardized Trees (ST)
- Semantic Evaluation - Executes the program and produces results
- ๐ง Modular Architecture - Clean separation of lexer, parser, and evaluator components
- ๐ณ Tree Visualization - Optional AST and ST output for debugging and learning
- ๐ Multiple Build Options - Support for both Maven and Makefile builds
- ๐ Comprehensive Testing - Includes test cases for validation
- ๐ฏ Standards Compliant - Full RPAL language specification support
- Java JDK 8+ (tested with Java 21)
- Maven 3.6+ (for Maven build method)
- Make utility (for Makefile build method)
# Clone the repository
git clone <repository-url>
cd rpal-lang-interpreter
# Clean and build the project
mvn clean installThis creates a JAR file in the target/ directory.
# Navigate to source directory
cd rpal/src/main/java
# Compile using make
makeThis generates .class files in the same directory structure.
java myrpal <input_file>java myrpal test/test1 > output.txtUse optional switches to visualize internal tree structures:
| Switch | Description |
|---|---|
-ast |
Print Abstract Syntax Tree |
-st |
Print Standardized Tree |
# Run basic interpretation
java myrpal test/test1
# View AST structure
java myrpal -ast test/test1
# View both AST and ST
java myrpal -ast -st test/test1
# Save output to file
java myrpal -ast test/test1 > debug_output.txtrpal-lang-interpreter/
โโโ src/
โ โโโ main/
โ โโโ java/
โ โโโ lexer/ # Lexical analysis components
โ โโโ parser/ # Syntax parsing and AST generation
โ โโโ evaluator/ # Semantic evaluation engine
โ โโโ myrpal.java # Main entry point
โโโ test/ # Test cases and examples
โโโ target/ # Maven build output
โโโ pom.xml # Maven configuration
โโโ Makefile # Alternative build configuration
โโโ README.md # This file
Maven provides dependency management, testing integration, and packaging:
# Clean previous builds
mvn clean
# Compile and package
mvn compile package
# Run tests
mvn test
# Complete build with tests
mvn clean installFor environments where Maven isn't available or for submission requirements:
cd rpal/src/main/java
make clean # Remove previous .class files
make # Compile all source fileslet add x y = x + y
in add 5 3
# Assuming the above code is saved as 'sample.rpal'
java myrpal sample.rpal
# Output: 8
# View the AST structure
java myrpal -ast sample.rpalThe project includes comprehensive test cases in the test/ directory:
# Run all test cases using Makefile
make testWe welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is developed as part of an academic assignment. Please respect academic integrity guidelines when using this code.
Java version compatibility: Ensure you're using JDK 8 or higher
java -versionMaven not found: Install Maven or use the Makefile alternative
mvn --versionClass not found errors: Ensure you're running from the correct directory after building
Made by Team Atlantis
Building bridges between theory and practice, one parse tree at a time.