
In the example 3 4 -, first the 3 is put onto the stack, then the 4 the 4 is now on top and the 3 below it. The concept of a stack, a last-in/first-out construct, is integral to the left-to-right evaluation of RPN. The expression 3 − 4 + 5 in conventional notation is 3 4 − 5 + in reverse Polish notation: 4 is first subtracted from 3, then 5 is added to it. For example, to add 3 and 4 together, the expression is 3 4 + rather than 3 + 4. In reverse Polish notation, the operators follow their operands. In computer science, reverse Polish notation is used in stack-oriented programming languages such as Forth, STOIC, PostScript, RPL, and Joy. ĭuring the 1970s and 1980s, Hewlett-Packard used RPN in all of their desktop and hand-held calculators, and has continued to use it in some models into the 2020s.

The algorithms and notation for this scheme were extended by the Australian philosopher and computer scientist Charles L. Dijkstra in the early 1960s to reduce computer memory access and use the stack to evaluate expressions. The reverse Polish scheme was again proposed in 1954 by Arthur Burks, Don Warren, and Jesse Wright and was independently reinvented by Friedrich L. The first computer to use postfix notation, though it long remained essentially unknown outside of Germany, was Konrad Zuse's Z3 in 1941 as well as his Z4 in 1945. The description "Polish" refers to the nationality of logician Jan Łukasiewicz, who invented Polish notation in 1924.


It does not need any parentheses as long as each operator has a fixed number of operands. Reverse Polish notation ( RPN), also known as reverse Łukasiewicz notation, Polish postfix notation or simply postfix notation, is a mathematical notation in which operators follow their operands, in contrast to Polish notation (PN), in which operators precede their operands.
