[Haskell-cafe] Parsing workflow

Stephen Tetley stephen.tetley at gmail.com
Sun Oct 31 11:55:28 EDT 2010


If you use the Language and Token modules, Parsec gives you something
close to a lexer / parser separation _but_ you can drop down to
character level parsers if you want to - this is very handy. There are
some caveats though - for instance, the number parsers from the Token
module follow Haskell's lexical syntax but you can override them if
necessary.

You can also write separate parsers this is covered in the (pdf)
Parsec manual available from Daan Leijen's old home page, however I
usually avoid this as it seems rather cumbersome.

Happy / Alex seems generally much faster than Parsec, I would imagine
the combination of Happy and Parsec to inherit the speed of Parsec.

Personally I prefer Parsec, uu-parsing is also nice but it didn't have
the equivalent of Parsec's Token parsers so it was always a bit less
convenient. However, if I'm starting from an LR grammar I'll use Happy
/ Alex.


More information about the Haskell-Cafe mailing list