Why are prefix and postfix arithmetic expressions created and even used? What are their advantages and disadvantages?

(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
3 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
PWolff
2 years ago

has already mentioned the basics of Polish notation (the logicians who introduced the prefix notation happened to be Polish, hence the name).

Postfix notation is the order in which computers process values ​​and operators internally. This is why the first calculators used this notation, and the FORTH programming language, for example, which runs on even the most primitive computers, still uses this notation today.

The infix notation is closer to our spoken language, and it also feels more "natural" to allow expressions with an indefinite number of operators.

I wouldn't call this a deficiency , just a disadvantage compared to infix notation.

(Regarding natural language, I'm reminded of the abbreviation SPQR from the Roman banners in the Asterix comics. It stands for "senatus populusque romanus"—the Roman Senate and the Roman people—with the suffix "-que" meaning "and." So, it's not quite so clear-cut with natural language.)

Bushmills145
2 years ago
Reply to  PWolff

huch, da kennt jemand Forth! Hut ab.

Bushmills145
2 years ago

On the one hand, postfix notation allows very simple evaluation of the expression, since no consideration of precedents is required: evaluation can be done strictly in the order in which the terms of the expression appear.

Furthermore, operators only work with operands that are already known, and thus RPN is very well suited to stack-oriented languages ​​or input methods.