Alternative approach of
read that composes grammars instead
of parsers. Grammars describing the data types are composed
dynamically, removing possible left-recursion and combining
common prefixes of alternatives.
gread defined here is able to handle the
associativities defined for infix operators.
Non uniform data types are not supported, because they generate infinite grammars.
The library is documented in the paper: Haskell, do you read me?: constructing and composing efficient top-down parsers at runtime
For more documentation see the TTTAS webpage: http://www.cs.uu.nl/wiki/bin/view/Center/TTTAS .
gread reads input from a string, which must be
completely consumed by the input process.
Ok value on a successful parse.
Rep value msgs, where the
results of parsing a repaired input. The list
contains the "corrections" done to the input.
For example, a
read-like implementation can be:
read :: (Gram a) => String -> a read input = case gread input of Ok a -> a Rep _ (m:_) -> error $ show m