3 ms·
Uhm, I wrote this a while ago: http://eli.thegreenplace.net/2010/01/02/top-down-operator-precedence-parsing/ http://eli.thegreenplace.net/2010/01/02/top-down-op
by eliben 16y ago
Uhm, I wrote this a while ago: http://eli.thegreenplace.net/2010/01/02/top-down-operator-precedence-parsing/ http://eli.thegreenplace.net/2010/01/02/top-down-operator-pr...
[sorry for the plug, but I think my tutorial is more comprehensive in terms of explaining how the thing actually works]
- silentbicycle 16y agoI agree - I find your post is clearer than the original paper, Crockford's explanation, and Lundh's Python post. It helps that you start with just addition and multiplication, then add more functionality after explaining the basics.
- munificent 16y agoThat post is excellent! Somehow I didn't find that when I was looking to learn more about TDOP. The only change I made from yours and Pratt's is that I split out the nud and led parsers completely. It seemed weird to me to lump them together just because they share a token when they aren't semantically related. For example, the "(" token handles grouping in prefix position and function calls in infix, and those don't have anything to do with each other, so I split out PrefixParselets and InfixParselets into entirely separate dictionaries.