In reverse Polish notation, the
operators follow their
operands. For example, to add 3 and 4 together, the expression is rather than . The conventional notation expression becomes in reverse Polish notation: 4 is first subtracted from 3, then 5 is added to it. The concept of a
stack, a last-in/first-out construct, is integral to the left-to-right evaluation of RPN. In the example , first the 3 is put onto the stack, then the 4; the 4 is now on top and the 3 below it. The subtraction operator removes the top two items from the stack, performs , and puts the result of −1 onto the stack. Common language in this context refers to items being pushed onto the stack when added and popped or removed from the stack when taken off. The advantage of reverse Polish notation is that it removes the need for order of operations and parentheses that are required by
infix notation and can be evaluated linearly, left-to-right. For example, the infix expression becomes in reverse Polish notation. == Practical implications ==