Jordan Eldredge

Bob Nystrom explains the Pratt Parser algorithm

|

One of the most challenging things to express cleanly in a parser is operator precedence. That’s why I’m so enamored of this blog post by Bob Nystrom, the author of my favorite compiler book. Pratt Parsers: Expression Parsing Made Easy. This post provides an incredibly approachable breakdown of how to implement a Pratt parser. While the algorithm can take some time to wrap your head around, Bob does a great job of helping you get there. And once you get it, the result is a nice tidy way to express precedence in your parser.

https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/