A fast, minimal parser.
A fast, minimal parser.
parsnip
parses null-terminated input strings with an absolute minimum of internal state. It copies the input to a c string and works its way through hand-over-hand with just an Addr#
as the internal state.
It uses reflection
-like tricks to lift the input ByteString
into a constraint that is then passed to just the combinators that need access to it to compute position, snip out slices of the original, or ask the number of bytes remaining, but none of the monadic combinators nor simple satisfy
or eof
predicates need access to this information.
Because of the null-termination, we can't assume that we can handle binary inputs, but this works well for text-based source languages.
parsnip
This is a rather minimal parsing library for applications that do not need nice error messages.
Use with a library like parsers
or parser-combinators
to fill in the missing functionality.
Contact Information
Contributions and bug reports are welcome!
Please feel free to contact me through github or on the #haskell IRC channel on irc.freenode.net.
-Edward Kmett.