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

Safe HaskellNone
LanguageHaskell2010

Text.Grampa.ContextFree.LeftRecursive

Synopsis

Documentation

data Fixed p g s a Source #

Instances

GrammarParsing (Fixed Parser) Source # 

Associated Types

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

MultiParsing (Fixed Parser) Source #

Parser of general context-free grammars, including left recursion.

parseComplete :: (Rank2.Apply g, Rank2.Traversable g, FactorialMonoid s) =>
                 g (LeftRecursive.'Fixed g s) -> s -> g (Compose ParseResults [])

Associated Types

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

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

MonoidParsing (Fixed Parser g) Source # 
(Alternative (p g s), Monad (p g s)) => Monad (Fixed p g s) Source # 

Methods

(>>=) :: Fixed p g s a -> (a -> Fixed p g s b) -> Fixed p g s b #

(>>) :: Fixed p g s a -> Fixed p g s b -> Fixed p g s b #

return :: a -> Fixed p g s a #

fail :: String -> Fixed p g s a #

Functor (p g s) => Functor (Fixed p g s) Source # 

Methods

fmap :: (a -> b) -> Fixed p g s a -> Fixed p g s b #

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

Alternative (p g s) => Applicative (Fixed p g s) Source # 

Methods

pure :: a -> Fixed p g s a #

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

(*>) :: Fixed p g s a -> Fixed p g s b -> Fixed p g s b #

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

Alternative (p g s) => Alternative (Fixed p g s) Source # 

Methods

empty :: Fixed p g s a #

(<|>) :: Fixed p g s a -> Fixed p g s a -> Fixed p g s a #

some :: Fixed p g s a -> Fixed p g s [a] #

many :: Fixed p g s a -> Fixed p g s [a] #

MonadPlus (p g s) => MonadPlus (Fixed p g s) Source # 

Methods

mzero :: Fixed p g s a #

mplus :: Fixed p g s a -> Fixed p g s a -> Fixed p g s a #

(LookAheadParsing (p g s), TokenParsing (p g s), MonoidParsing (Fixed p g), Show s, TextualMonoid s) => TokenParsing (Fixed p g s) Source # 

Methods

someSpace :: Fixed p g s () #

nesting :: Fixed p g s a -> Fixed p g s a #

semi :: Fixed p g s Char #

highlight :: Highlight -> Fixed p g s a -> Fixed p g s a #

token :: Fixed p g s a -> Fixed p g s a #

(LookAheadParsing (p g s), MonoidParsing (Fixed p g), Show s, TextualMonoid s) => CharParsing (Fixed p g s) Source # 

Methods

satisfy :: (Char -> Bool) -> Fixed p g s Char #

char :: Char -> Fixed p g s Char #

notChar :: Char -> Fixed p g s Char #

anyChar :: Fixed p g s Char #

string :: String -> Fixed p g s String #

text :: Text -> Fixed p g s Text #

(LookAheadParsing (p g s), MonoidParsing (Fixed p g)) => LookAheadParsing (Fixed p g s) Source # 

Methods

lookAhead :: Fixed p g s a -> Fixed p g s a #

(LookAheadParsing (p g s), MonoidParsing (Fixed p g)) => Parsing (Fixed p g s) Source # 

Methods

try :: Fixed p g s a -> Fixed p g s a #

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

skipMany :: Fixed p g s a -> Fixed p g s () #

skipSome :: Fixed p g s a -> Fixed p g s () #

unexpected :: String -> Fixed p g s a #

eof :: Fixed p g s () #

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

(Alternative (p g s), Monoid x) => Monoid (Fixed p g s x) Source # 

Methods

mempty :: Fixed p g s x #

mappend :: Fixed p g s x -> Fixed p g s x -> Fixed p g s x #

mconcat :: [Fixed p g s x] -> Fixed p g s x #

type GrammarFunctor (Fixed Parser) Source # 
type ResultFunctor (Fixed Parser) Source # 
type GrammarConstraint (Fixed Parser) g Source # 

data SeparatedParser p g s a Source #

Constructors

FrontParser (p g s a) 
CycleParser 

Fields

BackParser 

Fields

longest :: Fixed Parser g s a -> Fixed Parser g [(s, g (ResultList g s))] a Source #

Turns a context-free parser into a backtracking PEG parser that consumes the longest possible prefix of the list of input tails, opposite of peg

peg :: Fixed Parser g [(s, g (ResultList g s))] a -> Fixed Parser g s a Source #

Turns a backtracking PEG parser of the list of input tails into a context-free parser, opposite of longest

terminalPEG :: Monoid s => Fixed Parser g s a -> Fixed Parser g s a Source #

Turns a backtracking PEG parser into a context-free parser

parseSeparated :: forall g s. (Apply g, Foldable g, FactorialMonoid s) => g (SeparatedParser Parser g s) -> s -> [(s, g (ResultList g s))] Source #

Parse the given input using a context-free grammar separated into two parts: the first specifying all the left-recursive productions, the second all others. The first function argument specifies the left-recursive dependencies among the grammar productions.

separated :: forall g s. (Apply g, Distributive g, Traversable g) => g (Parser g s) -> g (SeparatedParser Parser g s) Source #

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