Shunting Yard Trace
A-Level · Data Structures

Shunting Yard infix → postfix

Converting 4 × (2 × 4³ + 5) to postfix, one token at a time. Watch when a token is pushed onto the operator stack versus when it's popped into the output queue — the rules that decide are precedence, associativity, and brackets.

Token stream

Operator stack

Top of stack is highlighted. A ( blocks any operator below it from being popped.

Output queue

Reading left to right, this is the postfix expression as it's built.

Ready. Reading 4 × (2 × 4^3 + 5) left to right.
Postfix so far: —
1 step/s
Step 0 / 12

Keyboard: ← → to step  ·  Space to play/pause  ·  R to reset