Parser.y rewrite with parser combinators

Spiwack, Arnaud arnaud.spiwack at tweag.io
Wed Oct 10 05:28:24 UTC 2018


On Tue, Oct 9, 2018 at 1:09 PM Vladislav Zavialov <vlad.z.4096 at gmail.com>
wrote:

> In fact, we do have a fair share of boilerplate in our current grammar
> due to lack of parametrisation. That's another issue that would be
> solved by parser combinators (or by a fancier parser generator, but
> I'm not aware of such one).
>

There is the Menhir [1] parser generator. It provides decent abstraction
mechanism. It also generate LR parsers, hence is more flexible than Happy.
And generates incremental parsers.

Of course, one would have to make it output Haskell a Haskell parser first.
But considering the effort it seem to have been to add a Coq backend, I'd
assume it would be less of an effort than porting the entire GHC grammar to
parser combinators. (one hard thing would be to decide how to replace the
ML functor mechanism that Menhir uses to generate functions from parsers to
parsers)

[1]: http://gallium.inria.fr/~fpottier/menhir/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20181010/854d7272/attachment.html>


More information about the ghc-devs mailing list