Hacker News new | ask | show | jobs
by jestar_jokin 4663 days ago
I've used parser combinator libraries (usually based on Parsec), and it's super nice being able to write your grammar as code, very quick and easy, but I'm not sure if it helps with the problems listed, since I think you still need to manually write a bunch of code to process the parsed tokens.
1 comments

I've used a few Parsec-based parser combinators and now I'd never go back to a parser generator.

It might be a little slower at runtime, but the ability to see everything in your chosen language is worth it in my opinion.

It doesn't have to be slower at runtime.

Parsec will by default have to be slower, because it allows eg infinite backtracking / lookahead. If you use a parser combinator library that has less power, you can make it faster. E.g. if your library only has to exprose on Applicative interface.

I am working on a Parsec-like library for parsing regular languages (as in theoretical computer sience, not as in Perl). As opposed to grep I want to do something with the results instead of just accepting / rejecting, and I also want to expose more operators under which regular languages are closed, like difference or intersection (i.e. parallel match) or matching all elements of a set once but in any order, or chopping off a regular prefix or suffix.