3 ms·
I don't think Parsec is "extremely slow." It's not as fast as attoparsec, but not bad either. Trifecta has the best error messages, but takes some more work to
by kccqzy 9y ago
I don't think Parsec is "extremely slow." It's not as fast as attoparsec, but not bad either.
Trifecta has the best error messages, but takes some more work to fully make the error messages great.
- Peaker 9y agoIn my experience using Parsec, it was extremely slow. Took around 20 seconds to parse a few hundred thousand lines (almost no backtracking, too). Attoparsec/parsec have very similar APIs. I wonder why it cannot parse optimistically with attoparsec, and in case of failure - re-parse with parsec to get a nice error message. This should yield the best of both worlds?
- mrkgnao 9y agoMegaparsec is more actively maintained than Parsec (which it's a fork of). You could try that. It's not as fast as attoparsec, but it's close.
- mrkgnao 9y agoTrifecta has poor documentation. I've been thinking about reading the Idris parser to learn trifecta/parsers.
- axman6 9y agoTrifecta is best used via the parsers library, which is fairly well documented. This also (in theory) allows you to switch which parser you use between trifecta, parsec, attoparsec and even ReadP. I say in theory because the the semantics of these libraries differ.
- quchen 9y agoI recommend the much smaller project by Merijn, lambda-except [1]. I learned Trifecta from it, and it’s really not all that difficult, just embarassingly poorly documented. I then wrote the parser for my STGi project based on Trifecta, so that may also be worth a look. [1]: https://github.com/merijn/lambda-except https://github.com/merijn/lambda-except [2]: https://github.com/quchen/stgi/blob/master/src/Stg/Parser/Parser.hs https://github.com/quchen/stgi/blob/master/src/Stg/Parser/Pa...