Contents    Page-10    Prev    Next    Page+10    Index   

Arithmetic Expressions

Example: (A + B) * C + D

Ambiguous grammar:

E identifier | number
OP + | - | * | /
E E OP E
E ( E )

Unambiguous grammar:

E E + T | E - T
E T
T T * F | T / F
T F
F ( E )
F identifier | number

E, T, F stand for expression, term, and factor.