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

John Meacham john@foo.net
Thu, 10 May 2001 14:22:04 -0700


Just out of curiosity, has anyone done any work at benchmarking the
various parsers? I use Parsec pretty exclusivly since it comes with ghc
and is pretty straightforward and lightweight to use. I am wondering
what I am giving up in terms of speed by going that route, rather than
Happy or the compiler toolkit non-monadic but pure-haskell parser? hmm...
	John

On Thu, May 10, 2001 at 03:42:00PM +0100, Simon Marlow wrote:
> 
> S. Alexander Jacobson writes:
> 
> > I am not a parsing expert, but given the recent discussion on 
> > macros, I
> > have to ask: why use happy rather than monadic parsing?  
> > Monadic parsing
> > allows you to avoid a whole additional language/compilation 
> > step and work
> > in Hugs (where you don't have a makefile).  What does Happy 
> > 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).

-- 
--------------------------------------------------------------
John Meacham   http://www.ugcs.caltech.edu/~john/
California Institute of Technology, Alum.  john@foo.net
--------------------------------------------------------------