incremental-parser alternatives and similar packages
Based on the "Parsing" category.
Alternatively, view incremental-parser alternatives based on common mentions on social networks and blogs.
-
megaparsec
Industrial-strength monadic parser combinator library -
Earley
Parsing all context-free grammars using Earley's algorithm in Haskell. -
trifecta
Parser combinators with highlighting, slicing, layout, literate comments, Clang-style diagnostics and the kitchen sink -
replace-megaparsec
Stream editing with Haskell Megaparsec parsers -
parser-combinators
Lightweight package providing commonly useful parser combinators -
descriptive
Self-describing consumers/parsers; forms, cmd-line args, JSON, etc. -
scanner
Fast non-backtracking incremental combinator parsing for bytestrings -
pipes-aeson
Encode and decode JSON streams using Aeson and Pipes. -
weighted-regexp
Regular Expression Matching in Haskell -
pipes-attoparsec
Utilities to convert a parser into a pipe -
parsec-free
Parsec API encoded as a deeply-embedded DSL, for debugging and analysis -
data-stm32
ARM SVD and CubeMX XML parser and pretty printer for STM32 family -
hsemail
Haskell Parsec parsers for the syntax defined in RFC2821 and 2822 -
replace-attoparsec
Stream editing with Haskell Attoparsec parsers -
parsec-parsers
Orphan instances so you can use `parsers` with `parsec`. -
parsers-megaparsec
`parsers` instances for Megaparsec -
record-syntax
A library for parsing and processing the Haskell syntax sprinkled with anonymous records -
matrix-market-attoparsec
Attoparsec parsers for the NIST Matrix Market format -
attoparsec-parsec
An Attoparsec compatibility layer for Parsec -
attoparsec-expr
Port of parsec's expression parser to attoparsec. -
fuzzy-dates
Automatically detect and parse dates in many different formats -
streaming-binary
Incremental serialization and deserialization of Haskell values. -
syntactical
Haskell library for distfix expression parsing -
antlrc
Haskell binding to the ANTLR parser generator C runtime library http://www.antlr.org/wiki/display/ANTLR3/ANTLR3+Code+Generation+-+C -
attoparsec-data
Parsers for the standard Haskell data types -
hspec-parsec
Hspec expectations for testing Parsec parsers
Static code analysis for 29 languages.
Do you think we are missing an alternative of incremental-parser or a related project?
README
The incremental-parser library is yet another parser combinator library, providing the usual set of Applicative
,
Alternative
, and Monad
combinators. Apart from this, it has four twists that make it unique.
Parsing incrementally
First, the parser is incremental. Not only can it be fed its input in chunks, but in proper circumstances it can also
provide its output in parsed chunks. For this to be possible the result type must be a Monoid
. The complete parsing
result is then a concatenation of the partial results.
In order to make the incremental parsing easier, the combinator set is optimized for monoidal results. Apart from the
usual combinators many
and some
, for example, there are concatMany
and concatSome
operators.
many :: Parser s r -> Parser s [r]
concatMany :: (Monoid s, Monoid r) => Parser s r -> Parser s r
Arbitrary monoidal inputs
The second weirdness, this one shared with Picoparsec, is that the the parser is generic in its input stream type, but this type is parameterized in a holistic way. There is no separate token type. Primitive parsers that need to peek into the input require its type to be an instance of a monoid subclass, from the monoid-subclasses package.
In Parsec:
string :: Stream s m Char => String -> ParsecT s u m String
char :: Stream s m Char => Char -> ParsecT s u m Char
anyToken :: (Stream s m t, Show t) => ParsecT s u m t
In Attoparsec:
string :: ByteString -> Parser ByteString
word8 :: Word8 -> Parser Word8
anyWord8 :: Parser Word8
In incremental-parser and Picoparsec:
string :: (LeftCancellativeMonoid s, MonoidNull s) => s -> Parser s s
token :: (Eq s, FactorialMonoid s) => s -> Parser s s
anyToken :: FactorialMonoid s => Parser s s
Two Alternative
alternatives
The library being implemented on the basis of Brzozowski derivatives, it can provide both the symmetric and the
left-biased choice, <||>
and <<|>
. This is the same design choice made by
Text.ParserCombinators.ReadP
and
uu-parsinglib. Parsec and its progeny on the other hand provide only
the faster left-biased choice, at some cost to the expressiveness of the combinator language. The standard <|>
operator from the Alternative
class acts as one or the other of the above, depending on whether the first type
parameter of Parser
is Symmetric
or LeftBiasedLocal
.
MonadFix
and record
Finally, the parser is an instance of the MonadFix
class. Beware of its power. In particular, never ever try to
mfix
a strict function. This will hang. The argument of mfix
takes the value constructed by the argument parser at
the very same input position it's looking at. The best and probably the only safe and useful argument to mfix
is the
record
function. See the construct library for examples.