Demystifying Parsers
summary
Shows how to parse YAML-like lists in Elm by actually building a parser with elm/parser and using concrete combinators: chompWhile, chompIf, getChompString, loop and oneOf. Demonstrates that consuming a character commits the path (no backtracking), implements an inline list parser, then extends it to nested, indentation-aware lists using getColumn. Presents error-message insertion, test-driven iteration, and confirms the parsers work on examples without exotic machinery—just small helpers, recursion via loop, and careful chomp logic.
AI-written summary · about
chapters (14)
- 0:00Introduction to parsers
- 2:24What is a parser
- 4:12Parser library overview
- 6:44Basic parsing with chomp
- 9:16Chomp helpers and string parsing
- 10:38Handling optional elements
- 12:53Parser commitment and failure
- 13:35Recursive parsing with loops
- 15:39Parsing inline lists
- 17:04Error messages in parsers
- 18:12Parsers are simple
- 18:52Testing parsers with TDD
- 19:14Parsing indentation in YAML
- 21:44Conclusion and resources
