3 ms·
Well, there is the speed argument. Regular expressions (not the pcre kind with backtracking and stuff) are blazing fast. Ragel[1] is a good example of that. In
by Drup 10y ago
Well, there is the speed argument. Regular expressions (not the pcre kind with backtracking and stuff) are blazing fast. Ragel[1] is a good example of that. In general, though, I actually agree.
[1]: http://www.colm.net/open-source/ragel/ http://www.colm.net/open-source/ragel/
- chongli 10y agoAmong parser combinator libraries, attoparsec[0] is no slouch. It gets very close to the speed of the hand-rolled http-parser library while being much shorter, easier to read, and maintain[1]. [0] https://hackage.haskell.org/package/attoparsec https://hackage.haskell.org/package/attoparsec [1] http://www.serpentine.com/blog/2010/03/03/whats-in-a-parser-attoparsec-rewired-2/ http://www.serpentine.com/blog/2010/03/03/whats-in-a-parser-...
- tantalor 10y agoAnother good example is RE2: https://github.com/google/re2 https://github.com/google/re2 It's pretty fast too. I don't know whether you can compare the performance of Ragel to regex libraries like RE2; they look like they solve different problems.
- gergoerdi 10y agoAs I mentioned in another comment, there are applicative parser combinator libraries for regular languages, e.g. https://hackage.haskell.org/package/regex-applicative https://hackage.haskell.org/package/regex-applicative so asymptotic speed is orthogonal to 'combinatorialness'.
- Drup 10y agoIf you look at the API of ocaml-re (and tyre), you'll see it's pretty much equivalent to regex-applicative. Regex combinators are nice. "Parser combinators", for me, denotes actual parsers, for non-contextual or contextual grammars.