I was reading a lot about Haskell Parser Combinators and found a lot of topics like:
But all these topics compare Parser Combinators
with Parser Generators
.
I want to ask you which of Parser Combinator
suits best the following conditions:
I've found out, that the most popular parser combinators are:
I would say definitely go with Parsec, heres why:
Attoparsec is designed to be quick to use, but lacks the strong support for error messages you get in Parsec, so that is a win for your first point.
My experience of using parser combinator libraries is that it is really easy to test individual parts of the parsers, either in GHCi or in tests, so the second point is satisfied by all of them really. Lastly, Attoparsec and Parsec are pretty darn fast.
Finally, Parsec has been around longest and has many useful and advanced features. This means that general maintainability is going to be easier, more examples are in Parsec and more people are familiar with it. uu-parsinglib is definitely worth the time to explore, but I would suggest that getting familiar with Parsec first is the better course for these reasons. (Alex is also the most recommended lexer to use with Parsec or otherwise, but I have not used it myself.)