This program will run correctly only with Reverse Polish Notation. Reverse
Polish Notation is a special form of writing mathematical expressions. This form is used
because it is easier for a computer program to read in the expression and use it. For
example, to write
3 + 2,
you have to write
3 2 +.
If we wanted to write something like
3 * (5 + 4),
we would write, in Reverse Polish Notation,
3 5 4 + *.
To evaluate this expression, we would simply do this:
3 5 4 + * = 3 9 * = 27.
To write a more complicated expression, like
5 + 3 / ((6 - 4) * 9 + 13),
we write
5 3 13 9 6 4 - * + / +.
It is much easier for a computer to read in a bunch of numbers and punctuation marks
than to read in a whole bunch of confusing parentheses.