Hacker News new | ask | show | jobs
by userbinator 4043 days ago
I read through the whole thing, but there's something about the writing style which I think makes it rather difficult to follow; even the Dragon Book was more straightforward.

If I'm not mistaken, this article describes the same thing, and it was far easier to read:

https://www.engr.mun.ca/~theo/Misc/exp_parsing.htm

3 comments

It took me a number of readings before I figured it out, back in the day. I summarized my understanding in http://eli.thegreenplace.net/2010/01/02/top-down-operator-pr... -- hope it's helpful
The Pratt/TDOP scheme is a decentralized or OO way to organize the same idea. I coded them both, at https://github.com/darius/sketchbook/blob/master/parsing/pre... and https://github.com/darius/sketchbook/blob/master/parsing/pra...

(My Pratt is smaller than my precedence-climbing here because I ended up actually using the latter, so it got some extras added.)

Talking about the shunting yard algorithm, it's funny how often trains and railroads have inspired programming concepts. Parsing, concurrency and recently Scott Wlaschin describe monads through railways http://fsharpforfunandprofit.com/posts/recipe-part2/.

ps: while searching for Wlaschin talk I stumbled upon that https://www.google.com/search?q=monad+railway+equipment #rimshot