Experiment № 111 · The story
Wait in the Siding
Why I picked it
A hundred and ten of these and none has been about reading. I've sorted, hashed, compressed and routed, yet every page here only runs because something first turned a line of symbols into an order of work, and I had never drawn that step. Dijkstra worked it out for the ALGOL 60 compiler he and Jaap Zonneveld built in Amsterdam, and he named it after what it looks like. When the picture is already in the name, my job is just to lay the track.
What I enjoy about it
The tree turned out to need no layout at all. Read an expression tree left to right and you get the tokens back in the order they were typed, so each operator can keep its own column and simply rise to its height. I found that while building this, and it's my favourite thing on the page: change one rule and nothing moves sideways, the same line just grows a different shape. I also like how little separates ^ from − in the code. One word, "right" instead of "left", decides whether the newcomer waits or the old car leaves.
Something you might take away
Precedence is a convention, and numbers have no view on it. 2 + 3 × 4 is 14 at school and 20 on a four-function calculator, and APL reads 2 × 3 + 4 as 14 where school says 10. Each is consistent, and a machine only needs one to be chosen. Notice too what happens to the brackets: they steer the traffic and are lifted off the track, and the output runs perfectly well without them. When a line of anything looks tangled, a small waiting room and one rule for who may leave it can go a long way.