grammatical-parsers-0.3.2: parsers that combine into grammars

Safe HaskellNone
LanguageHaskell2010

Text.Grampa.ContextFree.LeftRecursive

Synopsis

Documentation

data Fixed p g s a Source #

Instances
GrammarParsing (Fixed Parser) Source # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

Associated Types

type GrammarFunctor (Fixed Parser) :: ((Type -> Type) -> Type) -> Type -> Type -> Type 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 [])
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

MonoidParsing (Fixed Parser g) Source # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

(Alternative (p g s), Monad (p g s)) => Monad (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

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 # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

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 # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

Methods

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

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

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

(*>) :: 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 # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

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 # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

Methods

mzero :: Fixed p g s a #

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

(Lexical g, LexicalConstraint (Fixed Parser) g s, Show s, TextualMonoid s) => TokenParsing (Fixed Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

Methods

someSpace :: Fixed Parser g s () #

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

semi :: Fixed Parser g s Char #

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

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

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

Defined in Text.Grampa.ContextFree.LeftRecursive

Methods

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

(Parsing (p g s), MonoidParsing (Fixed p g), Show s, TextualMonoid s) => CharParsing (Fixed p g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

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 #

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

Defined in Text.Grampa.ContextFree.LeftRecursive

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 () #

AmbiguousParsing (Fixed Parser g s) Source # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

Methods

ambiguous :: Fixed Parser g s a -> Fixed Parser g s (Ambiguous a) Source #

(Alternative (p g s), Semigroup x) => Semigroup (Fixed p g s x) Source # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

Methods

(<>) :: Fixed p g s x -> Fixed p g s x -> Fixed p g s x #

sconcat :: NonEmpty (Fixed p g s x) -> Fixed p g s x #

stimes :: Integral b => b -> Fixed p g s x -> Fixed p g s x #

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

Defined in Text.Grampa.ContextFree.LeftRecursive

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 # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

type ResultFunctor (Fixed Parser) Source # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

type GrammarConstraint (Fixed Parser) g Source # 
Instance details

Defined in Text.Grampa.ContextFree.LeftRecursive

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 #