Functional implementation of parser combinators.
Author: Sebastian Fischer
(<|>)
:: ([a] -> [(b,[a])]) -> ([a] -> [(b,[a])]) -> [a] -> [(b,[a])]
Combines two parsers in an alternative manner. |
(<*>)
:: ([a] -> [(b,[a])]) -> (b -> [a] -> [(c,[a])]) -> [a] -> [(c,[a])]
Combines two parsers in a sequential manner. |
update
:: (a -> b) -> ([c] -> [(a,[c])]) -> [c] -> [(b,[c])]
Updates all parsed values of a parser |
(<.>)
:: ([a] -> [(b,[a])]) -> ([a] -> [(c,[a])]) -> [a] -> [(b,[a])]
Combines two parsers in a sequential manner. |
(<:>)
:: ([a] -> [(b,[a])]) -> ([a] -> [(c,[a])]) -> [a] -> [(c,[a])]
Combines two parser in a sequential manner. |
empty
:: a -> [b] -> [(a,[b])]
The empty parser which recognizes the empty word. |
satisfy
:: (a -> Bool) -> [a] -> [(a,[a])]
A parser recognizing a terminal satisfying a given predicate. |
terminal
:: Eq a => a -> [a] -> [(a,[a])]
A parser recognizing a particular terminal symbol. |
star
:: ([a] -> [(b,[a])]) -> [a] -> [([b],[a])]
A star combinator for parsers. |
some
:: ([a] -> [(b,[a])]) -> [a] -> [([b],[a])]
A some combinator for parsers. |
A parser maps a list of tokens into parsed values with remaining tokens.
Type synonym: Parser a b = [a] -> [(b,[a])]
Combines two parsers in an alternative manner.
|
Combines two parsers in a sequential manner.
|
Updates all parsed values of a parser |
Combines two parsers in a sequential manner. Ignores the result of the second parser.
|
Combines two parser in a sequential manner. Ignores the result of the first parser.
|
The empty parser which recognizes the empty word.
|
A parser recognizing a terminal satisfying a given predicate. |
A parser recognizing a particular terminal symbol. |
A star combinator for parsers. The returned parser repeats zero or more times a parser p and returns the result of all parsers in a list. |
A some combinator for parsers. The returned parser repeats the argument parser at least once. |