grammatical-parsers-0.1: parsers that can combine into grammars

Safe HaskellNone
LanguageHaskell2010

Text.Grampa.PEG.Packrat

Description

Packrat parser

Synopsis

Documentation

data Parser g s r Source #

Parser type for Parsing Expression Grammars that uses an improved packrat algorithm, with O(1) performance bounds but with worse constants and more memory consumption than Parser. The parse function returns an input prefix parse paired with the remaining input suffix.

Instances

GrammarParsing Parser Source # 

Associated Types

type GrammarFunctor (Parser :: ((* -> *) -> *) -> * -> * -> *) :: ((* -> *) -> *) -> * -> * -> * Source #

Methods

nonTerminal :: (g (GrammarFunctor Parser g s) -> GrammarFunctor Parser g s a) -> Parser g s a Source #

selfReferring :: Distributive g => g (Parser g s) Source #

fixGrammar :: Distributive g => (g (Parser g s) -> g (Parser g s)) -> g (Parser g s) Source #

recursive :: Parser g s a -> Parser g s a Source #

MultiParsing Parser Source #

Packrat parser

parseComplete :: (Rank2.Functor g, FactorialMonoid s) =>
                 g (Packrat.Parser g s) -> s -> g ParseResults

Associated Types

type ResultFunctor (Parser :: ((* -> *) -> *) -> * -> * -> *) :: * -> * Source #

type GrammarConstraint (Parser :: ((* -> *) -> *) -> * -> * -> *) (g :: (* -> *) -> *) :: Constraint Source #

MonoidParsing (Parser g) Source # 

Methods

endOfInput :: FactorialMonoid s => Parser g s () Source #

getInput :: MonoidNull s => Parser g s s Source #

anyToken :: FactorialMonoid s => Parser g s s Source #

token :: (Eq s, FactorialMonoid s) => s -> Parser g s s Source #

satisfy :: FactorialMonoid s => (s -> Bool) -> Parser g s s Source #

satisfyChar :: TextualMonoid s => (Char -> Bool) -> Parser g s Char Source #

scan :: FactorialMonoid t => s -> (s -> t -> Maybe s) -> Parser g t t Source #

scanChars :: TextualMonoid t => s -> (s -> Char -> Maybe s) -> Parser g t t Source #

string :: (FactorialMonoid s, LeftReductiveMonoid s, Show s) => s -> Parser g s s Source #

takeWhile :: FactorialMonoid s => (s -> Bool) -> Parser g s s Source #

takeWhile1 :: FactorialMonoid s => (s -> Bool) -> Parser g s s Source #

takeCharsWhile :: TextualMonoid s => (Char -> Bool) -> Parser g s s Source #

takeCharsWhile1 :: TextualMonoid s => (Char -> Bool) -> Parser g s s Source #

whiteSpace :: TextualMonoid s => Parser g s () Source #

concatMany :: Monoid a => Parser g s a -> Parser g s a Source #

Monad (Parser g s) Source # 

Methods

(>>=) :: Parser g s a -> (a -> Parser g s b) -> Parser g s b #

(>>) :: Parser g s a -> Parser g s b -> Parser g s b #

return :: a -> Parser g s a #

fail :: String -> Parser g s a #

Functor (Parser g s) Source # 

Methods

fmap :: (a -> b) -> Parser g s a -> Parser g s b #

(<$) :: a -> Parser g s b -> Parser g s a #

Applicative (Parser g s) Source # 

Methods

pure :: a -> Parser g s a #

(<*>) :: Parser g s (a -> b) -> Parser g s a -> Parser g s b #

(*>) :: Parser g s a -> Parser g s b -> Parser g s b #

(<*) :: Parser g s a -> Parser g s b -> Parser g s a #

Alternative (Parser g s) Source # 

Methods

empty :: Parser g s a #

(<|>) :: Parser g s a -> Parser g s a -> Parser g s a #

some :: Parser g s a -> Parser g s [a] #

many :: Parser g s a -> Parser g s [a] #

MonadPlus (Parser g s) Source # 

Methods

mzero :: Parser g s a #

mplus :: Parser g s a -> Parser g s a -> Parser g s a #

FactorialMonoid s => Parsing (Parser g s) Source # 

Methods

try :: Parser g s a -> Parser g s a #

(<?>) :: Parser g s a -> String -> Parser g s a #

skipMany :: Parser g s a -> Parser g s () #

skipSome :: Parser g s a -> Parser g s () #

unexpected :: String -> Parser g s a #

eof :: Parser g s () #

notFollowedBy :: Show a => Parser g s a -> Parser g s () #

Monoid x => Monoid (Parser g s x) Source # 

Methods

mempty :: Parser g s x #

mappend :: Parser g s x -> Parser g s x -> Parser g s x #

mconcat :: [Parser g s x] -> Parser g s x #

type GrammarFunctor Parser Source # 
type ResultFunctor Parser Source # 
type GrammarConstraint Parser g Source #