Contents    Page-10    Prev    Next    Page+10    Index   

Executing Reverse Polish

RPN is easily executed by a stack machine:

  1. Operands are pushed onto the stack.

  2. When an operator is encountered, the appropriate number of operands is popped from the stack and the operator is applied to them. The result is pushed onto the stack.

  3. When the end of the input expression is reached, the result is the top of the stack.

HP makes a line of pocket calculators that use RPN.