Re:Pratt Parsers: Expression Parsing Made Easy
by silentbicycle on Sunday March 20, 2011 @01:54PM
(#2346839)
I 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.
Re:Pratt Parsers: Expression Parsing Made Easy
by munificent on Monday March 21, 2011 @03:07AM
(#2348790)
That 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.
[sorry for the plug, but I think my tutorial is more comprehensive in terms of explaining how the thing actually works]