gll-0.2.0.3: GLL parser with simple combinator interface

Safe HaskellSafe-Inferred
LanguageHaskell98

GLL.Combinators.BinInterface

Synopsis

Documentation

type Parser a = (Visit1, Visit2, Visit3 a) Source

parse :: Parser a -> [Token] -> [a] Source

The semantic results of a parser, given a token string

parseString :: Parser a -> [Char] -> [a] Source

Parse a given string of characters

char :: Char -> Parser Char Source

A parser that recognises a given character

token :: Token -> Parser Token Source

A parser that recognises a given token

epsilon :: Parser () Source

A parser that always succeeds (and returns unit)

satisfy :: Ord a => a -> Parser a Source

A parser that always succeeds and returns a given value

many :: Ord a => Parser a -> Parser [a] Source

Apply the given parser many times, 0 or more times (Kleene closure)

some :: Ord a => Parser a -> Parser [a] Source

Apply the given parser some times, 1 or more times (positive closure)

optional :: Ord a => Parser a -> Parser (Maybe a) Source

Optionally use the given parser

(<::=>) :: String -> Parser a -> Parser a infixl 3 Source

use ::= to enforce using parse context (to handle left-recursion)

(<:=>) :: String -> Parser a -> Parser a infixl 3 Source

useful for non-recursive definitions (only internally)

(<$>) :: (Ord b, Ord a) => (a -> b) -> Parser a -> Parser b infixl 5 Source

Application of a semantic action.

(<$) :: (Ord a, Ord b) => a -> Parser b -> Parser a infixl 5 Source

Ignore all results and just return the given value

(<*>) :: (Ord a, Ord b) => Parser a -> Parser b -> Parser (a, b) infixl 6 Source

Sequence two parsers, the results of the two parsers are tupled.

(*>) :: (Ord a, Ord b) => Parser a -> Parser b -> Parser b infixl 6 Source

Sequencing, ignoring the result to the left

(<*) :: (Ord a, Ord b) => Parser a -> Parser b -> Parser a infixl 6 Source

Sequencing, ignoring the result to the right

(<|>) :: Ord a => Parser a -> Parser a -> Parser a infixl 4 Source

A choice between two parsers, results of the two are concatenated