Skip to content

garybs16/Compiler-Design-Toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›  Compiler Design Toolkit

A multi-language educational toolkit demonstrating key concepts in compiler construction, including lexical analysis and symbol table management.
Implemented in Python, Ruby, and Java, this collection of small projects showcases the core building blocks of a compiler.


πŸ“‚ Project Structure

Compiler_Design_Toolkit/ β”‚ β”œβ”€β”€ Project2/ β”‚ β”œβ”€β”€ Prog1.py # Python compiler-related script β”‚ └── Project Report.pdf # Report for Project2 β”‚ β”œβ”€β”€ Ruby Lexical Analyzer/ β”‚ β”œβ”€β”€ lexer.rb # Ruby program for lexical analysis β”‚ β”œβ”€β”€ source_code.txt # Sample input for the lexer β”‚ β”œβ”€β”€ Screenshot of correct output.png β”‚ β”œβ”€β”€ Project Report.pdf β”‚ └── README.md β”‚ └── Table/ β”œβ”€β”€ symbolTable.java # Symbol table in Java └── symbol_table.py # Symbol table in Python

✨ Features

  • Lexical Analysis (Ruby)

    • Tokenizes source code into keywords, identifiers, operators, and more.
    • Includes sample source code and screenshot of output.
  • Symbol Table Implementations

    • Java version (symbolTable.java)
    • Python version (symbol_table.py)
    • Stores identifiers, data types, and related metadata.
  • Python Compiler Component

    • Prog1.py demonstrates a compiler-related process (see PDF for details).

πŸ§‘β€πŸ’» How to Run

Ruby Lexical Analyzer

Requirements: Ruby 2.5+

cd "Ruby Lexical Analyzer"
ruby lexer.rb source_code.txt


Symbol Table (Java Version)
Requirements: Java JDK

bash
cd Table
javac symbolTable.java
java symbolTable
Symbol Table (Python Version)
Requirements: Python 3.x

bash
cd Table
python symbol_table.py
Python Compiler Script (Project2)
Requirements: Python 3.x

bash
cd Project2
python Prog1.py
πŸ“š Technologies Used
Python – Compiler utilities & symbol table

Ruby – Lexical analysis

Java – Symbol table

Standard I/O for reading and processing code

πŸ“„ Documentation
Each subproject includes a PDF report covering:

Theory & background

Implementation steps

Example runs

Observations

About

CPSC 323 project assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •