Prefixed notation
Notations prefixed, infix and postfixée
The notation prefixed is a form of writing of operations (such as the addition and the multiplication) in which the operators are written on the left operands and not between two as in the infix notation traditional .
The Polish notation is a prefixed notation invented by the mathematician Polish Jan Łukasiewicz, and which avoids the use of brackets. It is the most widespread form of notation prefixed in Informatique and Mathématiques from its simple grammar and its concision.
The notation postfixée place on the contrary the operator on the right. It is also called Polish notation reverses.
Example of prefixed notation
The computer programming language Lisp uses a prefixed notation, with brackets making it possible to put an unspecified number of operands.
The usual expression is noted:
(* 3 (+ 4 5 6))
The expression is interpreted by successively replacing the expression between brackets by the result of the operator writes on the left acting on the operands written with its continuation.
(* 3 (+ 4 5 6)) => (* 3 15) => 45
Example of notation prefixed without parenthesizing (Polish notation)
In Calculation of the proposals, Lukasiewicz introduced:
- NR for “not” the
- C for the implication
- has for “or”
- E for equivalence
- C for the implication
One has for example:
-
CpAqm :
- ACpqm: .
Example of postfixée notation
The language PostScript, following the example scientific computers Hewlet-Packard, uses a notation postfixée , which moreover can do without brackets, the operators having a fixed number of operands. This same expression is written then
3 4 5 add 6 add mul
The interpreter reads the operators and by piling up them, and carries out an operator on the operands piled up when it meets an operator, while giving the result on the pile. Thus, when it meets the operator add , it takes the two numbers the top of the pile and replaces them by their nap, and makes in the same way for the multiplication with the operator mul . The pile will thus have successively the following contents:
(3) >> (3 4) >> (3 4 5) > add > (3 9) >> (3 9 6) > add > (3 15) > mul > (45)
Analog in natural language
The prefixed notation of the expression given in example is similar to the expression in natural language: “the product of 3 and the sum of 4,5 and 6).
The analog in natural language of the postfixée notation would be rather confused…:
See too
-
Polish Notation reverses
- Arborescence
| Random links: | List editors of roleplays | Dierre | Grandizo Provided | Muziris | List characters of Desperate Housewives | Rosemberg_Pabón |