[Haskell-cafe] Parsing in Practice

Tom Hawkins tom at confluent.org
Tue Oct 18 11:24:43 EDT 2005

I am writing a parser for a big, ugly, standard language and I need to 
decide between using either Happy or Parsec.

I currently have a priliminary LALR(1) grammar, so a port to Happy would 
be relatively easy.  But, I'm wondering if life would be easier if I 
chose Parsec's combinator parsing instead.  It's error reporting seems 
to be top notch and it's "optional", "many", and "sepBy1" combinators 
are very elegant.

However, I have a few concerns with Parsec.  First is performance; what 
factor of slow-down should I expect?  Second is bug prevention.  I don't 
have much experience writing LL(n) grammars, so how easy is it to 
introduce bugs in a Parsec grammar?  Even though I hate debugging 
LALR(1) parsing ambiguities, it prevents problems.

Also, it appears the GHC developers chose Happy for Haskell.  What was 
their rational?

Thanks for your recommendations, one way or another.


More information about the Haskell-Cafe mailing list