Library with functional logic parser combinators.
Adapted from: Rafael Caballero and Francisco J. Lopez-Fraguas: A Functional Logic Perspective of Parsing. In Proc. FLOPS'99, Springer LNCS 1722, pp. 85-99, 1999
Author: Michael Hanus
Version: December 2012
(<|>)
:: ([a] -> [a]) -> ([a] -> [a]) -> [a] -> [a]
Combines two parsers without representation in an alternative manner. |
(<||>)
:: (a -> [b] -> [b]) -> (a -> [b] -> [b]) -> a -> [b] -> [b]
Combines two parsers with representation in an alternative manner. |
(<*>)
:: ([a] -> [a]) -> ([a] -> [a]) -> [a] -> [a]
Combines two parsers (with or without representation) in a sequential manner. |
(>>>)
:: ([a] -> [a]) -> b -> b -> [a] -> [a]
Attaches a representation to a parser without representation. |
empty
:: [a] -> [a]
The empty parser which recognizes the empty word. |
terminal
:: a -> [a] -> [a]
A parser recognizing a particular terminal symbol. |
satisfy
:: (a -> Bool) -> a -> [a] -> [a]
A parser (with representation) recognizing a terminal satisfying a given predicate. |
star
:: (a -> [b] -> [b]) -> [a] -> [b] -> [b]
A star combinator for parsers. |
some
:: (a -> [b] -> [b]) -> [a] -> [b] -> [b]
A some combinator for parsers. |
Type synonym: Parser a = [a] -> [a]
Type synonym: ParserRep a b = a -> Parser b
Combines two parsers without representation in an alternative manner.
|
Combines two parsers with representation in an alternative manner.
|
Combines two parsers (with or without representation) in a sequential manner.
|
Attaches a representation to a parser without representation.
|
The empty parser which recognizes the empty word.
|
A parser recognizing a particular terminal symbol.
|
A parser (with representation) recognizing a terminal satisfying a given predicate.
|
A star combinator for parsers. The returned parser repeats zero or more times a parser p with representation and returns the representation of all parsers in a list. |
A some combinator for parsers. The returned parser repeats the argument parser (with representation) at least once. |