Re: Advance notice that I'd like to make Cabal depend on parsec
Duncan Coutts <duncan.coutts <at> googlemail.com>
2013-03-14 17:02:39 GMT
On Thu, 2013-03-14 at 09:39 -0700, Jason Dagit wrote:
> > Why did I choose parsec? Practicality dictates that I can only use
> > things in the core libraries, and the nearest thing we have to that is
> > the parser lib that is in the HP. I tried to use happy but I could not
> > construct a grammar/lexer combo to handle the layout (also, happy is not
> > exactly known for its great error messages).
> Failed attempt aside for a moment, I think you should reconsider happy. Can
> you learn how to do layout from reading the GHC source?
Yes I looked at it, though Haskell's layout is a bit different.
> The happy documentation that explains how to attach a monad (you could
> use it to communicate between alex and happy for layout info) is a bit
> misleading but I have examples I can share with you.
Yes, that's what I was doing. I've used happy with monadic lexers with
feedback between the lexer and parser before, e.g. when I wrote the C
parser now used in language-c.
> I haven't specifically tackled the layout problem but I could try to
> make a parser if it would help.
> One major benefit of using happy is that the productions of the grammar can
> be analyzed for shift/shift and shift/reduce conflicts.
Right, I know and that's great. For example there's no way I could have
extended the C89 grammar I started with to cover C99 and GNU C