News for hackers. Stuff that matters.
Re:Unix History and the `DC` Calculator by adrian_b on Monday September 02, 2024 @01:35AM (#41422874)
When the expression is interpreted, not compiled, postfix has the advantage that you only need to memorize the yet unused operands.

With prefix, you have to memorize also the yet not executed operations and for each operation you need to memorize how many operands have already been provided for it, in order to execute the operation as soon as its last operand has been provided.

So for a compiled language it does not matter much whether an expression is written with prefix notation or with postfix notation, but for an interpreted language the latter is more efficient.

There are no comments on this comment yet.