Expression Parsing — Shunting-yard & RPN Evaluation

Tokens stream in; the operator stack defers operators by precedence while the output queue builds postfix (RPN). Then the RPN is evaluated on a value stack.

step 0
Shunting-yard

Operator stack

empty

Output queue (postfix / RPN)

empty

Value stack (RPN eval)

empty
Press Step to begin. We first convert infix to postfix with Shunting-yard, then evaluate the postfix on a value stack.
Result: pending
number operator parenthesis active token
Self-contained visualization. Precedence: ^ (right-assoc) > * / > + - (left-assoc). The output queue is exactly the postfix traversal of the parse tree; evaluating it left-to-right on a value stack yields the answer. See junior.md for the algorithm and professional.md for the correctness proof.