Modular grammar and parser for Haskell with extensions
summary
A modular parser and pretty-printer at github.com/blamario/language-haskell implements Haskell 2010 plus almost all extensions by composing finally-tagless mixins per extension into a grammar built with parser combinators (no separate lexer), supports left recursion via a fixed-grammar technique, and resolves operator precedences and layout with a custom approach. The project uses monet-subasses and grammatical-parsers, round-trips ~3,000 GHC test files in about 13 minutes, preserves comments and whitespace, and trades efficiency for composability.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:12Project origins and goals
- 4:01Dependencies and type-level
- 7:39Grammar composition
- 12:02Abstract syntax tree structure and wrappers
- 14:53Data flow and compiler
- 16:44Testing and benchmarks
- 18:33Future directions
- 21:50Live demo
- 24:02Q&A
related talks
41mParser Combinators
29mGrammar Inference for Ad Hoc Parsers
44mPretty Parsing
06mLightning Talk Slot #4: Modularizing GHC
31mEmbedding Functional Logic Programming in Haskell via a Compiler Plugin
52mBuilding a parser in C#, from first principles
47mIs There a Future for a Formally Specified Haskell Report
53mUnderstanding parser combinators: a deep dive
