L
L
Leonid K2016-09-02 00:11:36
Programming
Leonid K, 2016-09-02 00:11:36

Why do you need Reverse Polish Notation?

What can OPP be used for?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mercury13, 2016-09-02
@mreluzeon

1. Reverse Polish notation is easily calculated by a stack automaton. This automaton works extremely simply:
• you see an operand, put it on the stack.
• you see the operation — take as many elements from the stack as there are places in the operation, perform the operation and put the result back on the stack.
• In some automata (for example, in the same calculators) there is an auxiliary operation "input" (↑), separating one operand from another: 2+2 = 2 ↑ 2 +
Most virtual machines work on this principle - and the x87 coprocessor (if not I am mistaken, there is an 8-seat stack).
2. Reverse Polish notation is much more compact than the operation tree.
3. The reverse Polish notation does not have brackets, but, nevertheless, it clearly indicates which expressions this or that operation refers to. Having got used to it, a person will easily translate an entry from algebraic into reverse Polish and will not even touch modern “smart” calculators, which with brackets take into account the priority of multiplication over addition.

M
Maxim Moseychuk, 2016-09-02
@fshp

To get rid of parentheses. The expression in the NPV can be evaluated from left to right, reading character by character. This is not possible with parentheses.
FPU, for example, is just programmed using the OPC. Those. By converting the expression to the NPV, you can very easily write it in assembler.

E
evgeniy_lm, 2016-09-02
@evgeniy_lm

so it is more convenient to automate calculations

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question