Writing a language parser in 15min (or less)
summary
Shows how to turn a PEG grammar for a small Asciidoc subset into a working Go parser in minutes, using the Parsing Expression Grammars model and the pigeon generator to produce a Go file that emits an AST. Captures nested bold/italic/monospace, wires rule captures to Go constructors, runs targeted rule-level tests, then renders the AST to HTML via templates. Demonstration compiles the generated code and proves the pipeline from Asciidoc→HTML works end-to-end.
AI-written summary · about
chapters (13)
- 0:00Introduction and speaker background
- 1:05What is AsciiDoc markup
- 2:50Limitations of regex for parsing
- 3:12Introduction to PEG parsers
- 3:54Defining grammar rules
- 5:40How PEG parsing works in practice
- 7:49Handling parsing errors
- 8:31Generating parsers with Pigeon
- 9:55Extending PEG with Go code
- 11:00Live demo and generated parser
- 12:52Output as AST and HTML conversion
- 13:58Project resources and conclusion
- 14:47Q&A session
