Skip to content

spencerhall01/tips-interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TIPS Interpreter

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.

Features

  • 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

Repository Structure

.
├── 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

Build Instructions

Requirements

  • g++
  • flex
  • make

Build the Project

Just run make in the start folder. This will do the following:

  • Run Flex on exp-rules.l to generate lex.yy.c
  • Compile all source files
  • Output the tips executable

Usage

Run the interpreter by simply typing ./tips in the start folder followed by any flags followed by your .pas file.

Command-Line Options

  • -p --- print parse progress
  • -t --- print full parse tree
  • -s --- print symbol table
  • -d --- print tree deletion process

License

This repository is licensed under the MIT License. See LICENSE for details.

Citation

If you use this code or portions of it, please cite or acknowledge this repository :)