
8 Sep
2010
8 Sep
'10
8:59 a.m.
That compilation process is highly nonlocal and would never be possible with, e.g., the Parsec approach.
Pipe dream: attach such a grammar object to every Parsec parser, and include the "compiler" with the combinators, and have them run at (Haskell) compile time (in ghc's specializer). Should work for some subset (e.g., just let, not letrec, use proper combinators instead) and with some future ghc version ... When I teach parsing (in Compiler Construction), for lack of time it's either "traditional" (CFG -> PDA) or "combinator" (not both), and I'm not happy with that, since both are important concepts. But then, semantics is more important than syntax ... J.W.