Yacc


Compilers
Principles, Techniques, & Tools
Second Edition

A simple desk calculator that reads an arithmetic expression, evaluates it, and then prints its numeric value.

Starting with the grammer

digit = ['0' - '9']

E -> E + T | T
T -> T * F | F 
F -> (E) | digit