Chapter 7: Intermediate representation and symbol table

Postfix notation

. No parenthesis are needed in postfix notation because

- the position and parity of the operators permit only one decoding of a postfix expression

. Postfix notation for

a = b * -c + b * - c

is

a b c - * b c - * + =

No parenthesis is needed in postfix notation because it is made in a way that it has only one unique decoding. The parity of the operators (number of operands an operator takes) and their position uniquely determine the decoding. Have a look at the postfix notation example given above. We had made the AST and DAG for this example a couple of slides back. The edges in a syntax tree do not appear explicitly in postfix notation. They can be recovered from the order in which the nodes (operators) appear and the number of operands that the operators at the nodes expect. The recovery of edges is similar to the evaluation, using a stack, of an expression in postfix notation.