 <p>The post-fix notation is how you do the math in, say, a HP calculator.</p> <p>Keep a stack, whenever you get a number add it to the top. Whenever you get an operator consume inputs from the top and then add the result to the top</p> <pre><code>token stack *empty* 3 3 //push numbers... 4 3 4 2 3 4 2 * 3 8 //remove 4 and 2, add 4*2=8 1 3 8 1 5 3 8 1 5 - 3 8 -4 2 3 8 -4 2 3 3 8 -4 2 3 ^ 3 8 -4 8 ... ... </code></pre>