A variant of recursive decent parsing
summary
Claims a tiny, readable recursive‑descent parser replaces bulky generated code by using std::variant and visit with an overloaded lambdas via inheritance helper. The repo shows a working calculator parser that handles numeric literals, identifiers, store/drop keywords and parentheses, looks up variables, and throws on syntax errors. Code size and debuggability are the selling points: the parser is short, easy to test, and the example is implemented and runnable (source on GitHub).
AI-written summary · about
chapters (8)
- 0:00The problem with parsers
- 0:53Lexer and token challenges
- 1:41Introducing std::variant
- 2:47The limitation of visit
- 3:36Lambda visitor pattern
- 6:09Defining token types
- 7:18Implementing the parser
- 8:30Conclusion and applications
related talks
41mEnough TMP to write a Variant
49mEnough TMP to write a Variant
30mConcrete Syntax Metapatterns
59mHow to parse a file
49mApplied Modern C++: beyond type erasure and visitor pattern
01h 02mBreaking Dependencies - The Visitor Design Pattern in Cpp
01h 44mPractical Observable Sharing
28mThe Nano-parsing Architecture: Sane And Portable Parsing For Perverse Environments
