Resumable Parser Combinators
summary
A resumable parser combinator library is implemented for Scala string interpolation that suspends at interpolated non-String values and later resumes parsing, using a cats-parse–style combinator AST turned into an interpreter written in continuation passing style. A Resumable ADT stores the suspended parser, an intermediate value combined via a Semigroup, and continuations. A working markdown interpolator prototype embeds computed document fragments and interactive images. The code runs but a Scala 3 exhaustivity-checking compiler bug prevents a polished release.
AI-written summary · about
chapters (23)
- 0:00Introduction to talk
- 1:03What is notation
- 3:51Embedded DSLs with Scala
- 7:42Problem with parsing interpolation
- 9:07Designing resumable parsers
- 12:56Basic parser combinators
- 13:17Markdown parsing example
- 16:30Control API for suspension
- 17:35Result types in parsing
- 19:03Implementation techniques
- 20:50Continuation passing style
- 24:44Resumable type explained
- 27:30CPS in parser interpreter
- 30:23Does it work demonstration
- 31:24Markdown string interpolator
- 33:32Reusable lessons from project
- 33:54Scala 3 experience
- 35:38Programming strategies
- 36:42Interpreter pattern benefits
- 38:06Rarefy vs Church encoding
- 39:11CPS for stack safety
- 40:14Explicit semantics in code
- 41:58Q&A session
