Oriel — AI & technology worth noticing, every day.

Pratt parsing is a black box

Web page · https://vinipsmaker.github.io/blog/article/pratt-parsing-is-a-black-box

First seen by Oriel on .

AI summary

The article argues that effective Pratt parsing depends more on understanding token roles and binding powers than on studying its compact parsing algorithm.

  • Pratt reduces parsing decisions to whether a token expects an expression on its left.
  • A nud, or null denotation, expects nothing to its left, while a led, or left denotation, requires something there.
  • Unlike traditional parsers that attach semantic actions to production rules, Pratt parsers attach actions directly to terminal tokens.
  • The compiler example uses separate dispatch tables for nud handlers, led handlers, and binding powers covering prefixes, operators, calls, indexing, and postfix operations.
  • The core algorithm can fit in nine high-level-language lines and has remained unchanged since 1973.

#pratt parsing #compiler design #parsing algorithms

Generated by gpt-5.6-sol. Check the original for details.

Metric trends

Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained

Points

Score reported by the source.

  • Hacker News: 60, latest observation ; +57 over observed period since
  • Lobsters: 41, latest observation ; +40 over observed period since

Comments

Comment count reported by the source.

  • Hacker News: 32, latest observation ; +32 over observed period since
  • Lobsters: 11, latest observation ; +10 over observed period since

Aliases

SourceExternal IDURL
Hacker News50357457https://vinipsmaker.github.io/blog/article/pratt-parsing-is-a-black-box/ Read discussion
Lobstersbzazarhttps://vinipsmaker.github.io/blog/article/pratt-parsing-is-a-black-box/ Read discussion