Happy and Macros (was Re: ANNOUNCE: Happy 1.10 released)

Simon Marlow simonmar@microsoft.com
Thu, 10 May 2001 15:42:00 +0100


S. Alexander Jacobson writes:

> I am not a parsing expert, but given the recent discussion on=20
> macros, I
> have to ask: why use happy rather than monadic parsing? =20
> Monadic parsing
> allows you to avoid a whole additional language/compilation=20
> step and work
> in Hugs (where you don't have a makefile).  What does Happy=20
> buy you here?

It buys you (a) speed, (b) confidence that your grammar is
non-ambiguous, and (c) familiar BNF notation.  On the down side, as you
point out, you lose Haskell's abstraction facilities.

I'd be willing to sacrifice (c) in order to write parsers in Haskell,
but I don't think there's a combinator library that matches Happy in
terms of speed (disclaimer: I haven't exhaustively tested them all, but
given the tricks Happy does I'd be surprised).  AFAIK none of the
combinator libraries gives you (b).

Cheers,
	Simon