Place each operator after its operands. A binary application encodes its first subtree, then its second subtree, then the operator, a postorder traversal. A stack machine evaluates the tokens in one pass, popping the right operand before the left one. Reversing a Polish notation token list also reverses operand order: prefix subtraction
- a b would become b a - rather than the required a b -. Articles by others on the same topic
Reverse Polish Notation (RPN) is a mathematical notation in which operators follow their operands. It eliminates the need for parentheses to dictate the order of operations, which is required in standard mathematical notation. In RPN, an expression is evaluated by reading from left to right and applying operators as soon as their operands are available.