Parsing from first principles
summary
Builds a working SQL subset parser in Elixir using parser combinators (char, satisfy, choice, many, map, sequence, token, separated_list) and a lazy combinator to handle recursion for subqueries. Demo is ~160 lines and produces an AST map for SELECT columns and FROM (identifiers or subqueries); a production version grew to ~1,500 lines. Error reporting is basic; recommends adding position tracking, a two‑pass lexer, or using NimbleParsec for performance while keeping the combinator workflow for clarity.
AI-written summary · about
chapters (12)
- 0:00Introduction and setup
- 3:51Why avoid parsing fear
- 11:52Parser combinators introduction
- 23:11Parsing single characters
- 33:29Building identifier parser
- 40:12Handling whitespace and tokens
- 44:06Parsing SQL keywords
- 47:18Select statement structure
- 53:20Supporting subqueries
- 55:06Error handling challenges
- 59:21Final impressions and lessons
- 1:02:09Q&A and closing
related talks
37mThe Elixir parser under the microscope
53mUnderstanding parser combinators: a deep dive
29mMy Little Parser: Tooling is Magic
58mParsing in C# from first principles
26mParser Combinators in Swift
15mStaged Selective Parser Combinators
01h 27mBoost.Parser (Part 1 of 2) - A Parser Combinator Library for C++
09mScala Parser Combinators: The Easier Way to Create an External DSL
