Given an infix expression, the code parser it according to the grammar given in calc.yy and constructs an AST. It does tree-traversal procedures to prints postfix and prefix patterns of the given infix expressions and evaluate them.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install flex bison
$ which bison
$ which flex
There are two methods approached for tree-traversal.
- Normal Postfix pattern generation
- Postfix pattern generation using Visitor design pattern
Both directories have a Makefile
$ make
$ ./calc
$ make clean
- Make sure you install latest versions of flex and bison