[Haskell-cafe] Parser left recursion

Roman Cheplyaka roma at ro-che.info
Wed Feb 20 08:27:39 CET 2013


* Martin Drautzburg <Martin.Drautzburg at web.de> [2013-02-20 08:13:16+0100]
> I do know for sure, that it is possible to parse "(1+2)+3" (ghci does it just 
> fine). But I seem to be missing a trick.
> 
> Can anyone shed some light on this?

The trick in this case is that ghci doesn't use a recursive descent
parser — it uses an LR parser (generated by Happy).

Another workaround is to use memoization of some sort — see e.g. GLL
("Generalized LL") parsing.

Roman



More information about the Haskell-Cafe mailing list