Writing about pratt parsing so I remember it
dverlaeckt80
83 points
7 comments
October 27, 2026
Related Discussions
Found 5 related stories in 108.1ms across 10,780 title embeddings via pgvector HNSW
- Rusty thoughts on "Parse, don't validate" ingve · 82 pts · September 27, 2026 · 48% similar
- Parser Combinators schindlabua · 230 pts · October 18, 2026 · 47% similar
- Show HN: Yantra – an LALR(1) parser generator for C++ renjipanicker · 20 pts · October 01, 2026 · 43% similar
- The foolishness of "natural language programming" (1978) xiaoyu2006 · 93 pts · October 23, 2026 · 42% similar
- A few good ideas in programming languages airhangerf15 · 89 pts · September 12, 2026 · 42% similar
Discussion Highlights (2 comments)
jstanley
Personally I never found the shunting yard algorithm very intuitive at all. A recursive descent parser makes much more sense to me.
mjbq
Could I suggest also looking at a sed-inspired parsing language (a DSL) which is called nom and is documented at http://www.nomlang.org An example script for parsing symbolic expressions is at http://www.nomlang.org/eg/maths.parse.pss and another which turns the expressions into LaTeX is /eg/maths.tolatex.pss Nom may seem quite verbose. I have written another language (which compiles to nom) which I call Syntagma. The syntax of syntagma is much closer to EBNF but also has powerful additions, such as a "lookahead" syntax, a negated lookahead syntax (eg: "parse this as an expression if it is not followed by a multiply operator"). Also, Syntagma has a "condition" syntax, meaning that a parse rule will only reduce if the attributes of the parse tokens match certain conditions. An example of an expression parser written in Syntagma is at http://www.nomlang.org/syntagma/eg/expr.sta This is much more succinct than the equivalent nom script. The script /syntagma/eg/expr.toforth.sta converts symbolic expressions (and assignments) into Forth. Parsing is an interesting topic, but I feel that it is quite difficult or non-intuitive with some of the traditional tools and methods (at least for me).