[prev] [index] [next]

Exercise: Reverse Polish Notation

Normal arithmetic uses infix notation, e.g. 1 + 2

Infix places operator between operands.

An alternative notation puts operator last, e.g. 1 2 +

This postfix style is called reverse polish notation (RPN).

Advantages: no parentheses needed to disambiguate.