LParse alternatives and similar packages
Based on the "Parsing" category.
Alternatively, view LParse alternatives based on common mentions on social networks and blogs.
-
trifecta
Parser combinators with highlighting, slicing, layout, literate comments, Clang-style diagnostics and the kitchen sink -
Earley
Parsing all context-free grammars using Earley's algorithm in Haskell. -
replace-megaparsec
Stream editing with Haskell Megaparsec parsers -
parser-combinators
Lightweight package providing commonly useful parser combinators -
scanner
Fast non-backtracking incremental combinator parsing for bytestrings -
descriptive
Self-describing consumers/parsers; forms, cmd-line args, JSON, etc. -
parsec-free
Parsec API encoded as a deeply-embedded DSL, for debugging and analysis -
incremental-parser
Haskell parsing combinator liibrary that can be fed the input and emit the parsed output incrementally -
data-stm32
ARM SVD and CubeMX XML parser and pretty printer for STM32 family -
replace-attoparsec
Stream editing with Haskell Attoparsec parsers -
parsec-parsers
Orphan instances so you can use `parsers` with `parsec`. -
matrix-market-attoparsec
Attoparsec parsers for the NIST Matrix Market format -
record-syntax
A library for parsing and processing the Haskell syntax sprinkled with anonymous records -
streaming-binary
Incremental serialization and deserialization of Haskell values. -
fuzzy-dates
Automatically detect and parse dates in many different formats -
antlrc
Haskell binding to the ANTLR parser generator C runtime library http://www.antlr.org/wiki/display/ANTLR3/ANTLR3+Code+Generation+-+C
TestGPT | Generating meaningful tests for busy devs
Do you think we are missing an alternative of LParse or a related project?
README
λParse

A parser library using monads and arrows. Supports both horizontal and vertical composition of parsers.
Short Guide
Creating a parser
A parser is, at its heart, nothing more than a function that takes some input and either returns a result along with some residual, unconsumed input or that fails for some reason and returns an error message.
Since LParse is written in continuation-passing-style, this is modelled with a concept of DoubleContinuations - continuations that not only take one function to continue with, but one function to continue with in the case of a successful computation and one function to continue with in the case of a failure. This, of course, gives rise to classic parser semantics: To concatenate two parsers, the second one is put into the successful continuation of the first one, while for an alternative we put the second parser into the failure continuation of the first one.
These semantics are modelled with Monads and Alternatives, respectively, to make use of the familar syntax of these classes:
p1 >> p2
runsp1
andp2
in succession and gives the result ofp2
only(,) <$> p1 <*> p2
runsp1
andp2
in succession and gives the results ofp1
andp2
as a pairp1 <|> p2
runsp1
. On a success, its result is returned, on a fail,p2
is run. On a success, its result is returned, on a failure, the whole parser fails
The parser can be built from scratch by constructing a parser object with the appropriate function, but a variety of common atomic parsers and parser transformers are provided in Text.LParse.Prebuilt
.
The above construction is referred to as horizontal composition, i.e., running parsers successively on the same input.
The dual concept to this we refer to as vertical composition, where the result of one parser is fed into the next one as an input. An application for this could be one parser lex
that transforms a string into a list of tokens (a lexer) and a second parser par
that transforms a list of tokens into a syntax tree. Then we could join these to create a parser that directly transforms a string into a syntax tree as lex >>> par
As the notation above implies, LParse realises vertical composition with arrows enabling all the other features of arrows, such as the proc notation, to be used with parsers.
Running a parser
Once you have obtained a parser object that represents your entire parser, you have two options
You can supply a success and a failure function. When the parser is run, the appropriate function will be called, either with the result of the parse or an error message
You can retrieve the double continuation from the parser and continue to build with it. This is appropriate if your program itself is written in CPS.