A recursive descent parser and interpreter for the TIPS language, written in C++ and Flex. TIPS (Ten Instruction Pascal Subset) is a Turing complete subset of Pascal used primarily for educational purposes.
This project implements a full pipeline for parsing and interpreting a simplified programming language. It includes a lexer (Flex), a hand-written parser (recursive descent), and an abstract syntax tree (AST) interpreter.
Originally developed as part of a semester-long project, the code has been refined and organized for public use and demonstration.
- Full recurse descent parser for the TIPS language
- AST construction and pretty-printing
- Expression evaluation with support for arithmetic, logic, and nesting
- Symbol table support
- Read-write statements
- If/While/Compound blocks
.
├── start/ # All source code (parser, lexer, interpreter)
├── tests/ # Sample input (.pas) and expected output (.correct) files
├── LICENSE # License file (MIT)
└── README.md # Project overview and documentation
g++
flex
make
Just run make
in the start
folder. This will do the following:
- Run Flex on
exp-rules.l
to generatelex.yy.c
- Compile all source files
- Output the
tips
executable
Run the interpreter by simply typing ./tips
in the start folder followed by any flags followed by your .pas
file.
-p
--- print parse progress-t
--- print full parse tree-s
--- print symbol table-d
--- print tree deletion process
This repository is licensed under the MIT License. See LICENSE
for details.
If you use this code or portions of it, please cite or acknowledge this repository :)