5 ms·
Is there any advantage to using regex over a parser combinator?
by mchaver 10y ago
Is there any advantage to using regex over a parser combinator?
- gergoerdi 10y agoDepends on the parser combinator library. Real regexes can be matched in time linear in the input size; you'll need to use an applicative parser combinator like regex-applicative (https://hackage.haskell.org/package/regex-applicative https://hackage.haskell.org/package/regex-applicative) to get that kind of asymptotic complexity. A monadic one like Parsec is impossible to analyze statically to turn into a finite automaton.
- mchaver 10y agoInteresting. Attoparsec is usually my preferred parsing library, but regex-applicative looks very useful for smaller, less complicated parsers.