while (more input) {
next = nextToken()
if (next is operand)
push(next)
else apply next to top two operands and push the result
}
answer is on top of the stack
while (more input) {
next = nextToken()
if (next is operator) {
while (precedence(top) >= precedence(next)) { // **********not <=!
emit(top());
} // while
push(next)
} // if
else emit next
}
while !stack.isEmpty()
emit(pop())