Infix to Postfix Directed by a BU Parser
11/69
Example:
Rule: Semantic Action:
1: E ® E+E {generate(‘+’) }
2: E ® E*E {generate(‘*’) }
3: E ® (E) { - }
4: E ® i {generate(i.a) }
a
+
b
c
*
Input:
Output:
c
4
i
E
+
1
E
+
*
2
E
*
b
i
E
4
a
E
i
4
Gist: Semantic actions produce the postfix version of  the tokenized source program.