Introduction
I am currently building an introspectable parser combinator library.
This has been a goal of mine for a long time, but only recently did the idea make sense in my head, after I read Exploring Arrows for sequencing effects, so it is arrow-based now.
You can see parts of it working in the source or in the docs.
Example
-- >>> take 5 $ exampleWords binaryNumber
-- [fromList [One],fromList [One,Zero],fromList [One,One],fromList [One,Zero,Zero],fromList [One,Zero,One]]
binaryNumber :: Parser BinaryToken () ()
binaryNumber = exact One *> many digit $> ()
Although these are applicative operators, they use arrows under the hood. I just thought it was easier to write (because I’m used to it) with them.
Moreover, I plan to do static analysis on the parser, whenever it fails. This would allow the library to recover from a parsing failure and suggest repair sequences. (some terminology from laurence tratt). Producing example words, (inputs the parser would accept) is only a first step.
Input and Opinions
Finally, my question for your feedback and input:
In your favorite parsing library:
- what is the flavor of backtracking used
- e.g.: full backtracking, backtracking unless input was consumed, explicit backtracking?
- what do you like about it?
- what do you dislike about it?
- plus more if you care to share