Intuiting Pratt Parsing (louis.co.nz)

The article explains Pratt parsing as a way to build expression trees from flat tokens using intuition about left- vs right-leaning AST structure driven by operator precedence. It shows how precedence “transitions” require walking back up the current parse spine (implemented via recursion or a while-loop) to find where a new operator attaches. It also covers how binding power choices handle associativity, using left/right binding power (LBP/RBP) so right-associative operators nest correctly.

April 01, 2026 14:50 Source: Hacker News