erwinmedina / Tracer

CPSC 323 [Compilers] - Project 2 - Tracer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project 2 - Tracer

Objective:

Given the following CFG and the parsing table, write a program to trace input strings over the alphabet { i, +, -, *, /, ), ( } and ending with $.

How To Run:

  • Primarily written in C++, and utilizes a build.sh file in order to run.
  • Type chmod +x build.sh in the terminal/command prompt, allowing executable permissions.
  • Type ./build.sh into the terminal/command prompt to run the program.
  • If you're experiencing difficulties, contact me.

Programmer / Developer

Name Email
Erwin Medina erwinmedina@csu.fullerton.edu

Course Info

Course # Course Name Section Professor
CS-323 Compilers and Languages 03 Susmitha Padda

Results / Screenshots

Parsing Table:

States a + - * / ( ) $
E TQ TQ
Q +TQ -TQ ɛ ɛ
T FR FR
R ɛ ɛ *FR /FR ɛ ɛ
F a (E)
User Input Output
(a+a)*a$ First String
a*(a/a)$ Second String
a(a+a)$ Third String

The Good / The Bad

✅ Good! ❌ Bad :(
Completes objective. If first value is not found in parsing table than weird error occurs in stack.
Additional examples provides correct output. Info is a bit hardcoded to fit the parsing table that was provided. Further steps should be taken to make code more flexible.
User input has to contain a '$' at the end of string otherwise even if string CAN be traced, it'll say invalid.
White space is not handled at all.

About

CPSC 323 [Compilers] - Project 2 - Tracer


Languages

Language:C++ 99.0%Language:Shell 1.0%