Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

or prefix postfix or

Name: Anonymous 2012-04-22 16:42

infix get out

Name: Anonymous 2012-04-23 14:02

15 posts and no one mentions the fact that postfix has the advantage of being directly parse-able from left to right with nothing more than a simple pushdown automaton:

((20 4 /) ((5 2 -) (6 9 /) +) *)

20 4 / 5 2 - 6 9 / + *

push 20
push 4
divide
push 5
push 2
subtract
push 6
push 9
divide
add
multiply


The parenthesis are not necessary because the left-to-right reading order already implies the order of operations.  The result of the expression is the last value left on the stack.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List