[Haskell-cafe] GLR parser for Haskell?
benjamin.redelings at gmail.com
Thu Apr 15 14:10:56 UTC 2021
I've been looking at the Haskell parser in ghc/compiler/GHC/Parser.y.
It relies on post-processing pretty heavily, both to determine the type
of parsed expressions (i.e. is "(x,y)" a pattern or expression?) and to
reject invalid syntax (i.e. field declarations are parsed as a type, but
this is rejected during postprocessing I think, except in constructor
This makes the grammar rather hard to read. To quote :
> Insteadof describingthe languageto be parsed,thegrammardescribes
> theprocessused to parseit; it'smore like a hand-crafted parsing
> program,butcrammed into Backus-Naur Form.
Does anybody know if there is another version of the parser generator
uses grammar rules that are closer to the grammar rules in the 2010
report? Maybe a GLR grammar?
Also, I see that Happy is able to generate GLR parsers. I'm curious if
GLR parsers aren't being used just because they are slow, or if there is
some other reason they are hard to use. I am not an expert on parsing
or grammars, so any insight would be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe