Computing and Information Technology Interactive Digital Educational Library


Planet Math Computer Science  >
Planet Math Computer Science Collection >

Please use this identifier to cite or link to this item:

Title: reverse Polish notation
Issue Date: 10-Nov-2006
Publisher: PlanetMath
Abstract: Whereas operators are traditionally placed between operands, with parentheses used to override operator precedence, it is possible to place operators to the right of operands, thus eliminating ambiguity and the need for parentheses, and even the need for rules of operator precedence. This is known as ... reverse Polish notation (after the Polish mathematician Jan ... ), or ... postfix notation . Invented by Australian philosopher Charles Hamblin, reverse Polish notation requires that the number of operands of a given operator be defined in advance. For example, ... probably means 47, but if the possibility exists that the author meant but neglected to put in parentheses, the expression could actually mean ... . In reverse Polish notation, we could define the basic arithmetic operators to all be binary, and write ... with the confidence that it will evaluate to 47 and not 45. Reverse Polish notation is particularly advantageous for stack-based programming languages like Forth and Adobe PostScript. Most Hewlett-Packard calculators use reverse Polish notation (though a few, such as the HP-38G, use the sort of infix notation conventional to most calculators). Some beginning programming language courses give as an exercise to the student the implementation of an RPN calculator. Instead of having to remember multiple addresses for different variables and constants, most RPN implementations use a stack and a stack pointer to keep track of data. The factorial notation (e.g., ... ) is a fairly common use of postfix notation in mostly infix contexts. (Most unary operators in C++ are prefix). To convert from standard infix notation to reverse Polish notation, the Dutch computer programmer Edsger Dijkstra came up with the shunting yard algorithm.
Appears in Collections:Planet Math Computer Science Collection

Files in This Item:

File SizeFormat

All items in DSpace are protected by copyright, with all rights reserved.


Valid XHTML 1.0! DSpace Software Copyright © 2002-2006 MIT and Hewlett-Packard - Feedback