[Haskell-cafe] Parsec

Christian Maeder maeder at tzi.de
Wed Oct 19 08:29:28 EDT 2005


Hi,

So far I did not regret using Parsec for a huge language (like CASL 
http://www.tzi.de/cofi).

Compared to other combinator parser libraries, I think, it is best 
documented and the fastest (if used sensibly).

Error reporting could be better, but it is already better than that of 
happy. Usually, one does not want to stop at the first parse error, but 
rather try to collect several errors (that are not caused by previous ones).

I assume, alex and happy generated code will be faster. (I did not try 
to use a seperate lexer with Parsec.) But a slow-down of the parser (say 
by a factor of up to 3) is usually no problem. Much more time is spent 
elsewhere.

One disadvantage of combinator parsers is that the "grammar" is not as 
visible as in a happy file and needs more tuning (left factorization, etc.).

The major advantage is the great flexibility in combining parsing and 
other computations (possibly for lookaheads or dependent parsing) in one 
formalism (i.e. pure hasekll in a single module).

(The yacc features like precendences and associativities in grammar 
rules do not help much for user-definable precendences like in haskell.)

Christian


More information about the Haskell-Cafe mailing list