- class ProductionRule p where
- (>>>) :: p (a -> b) -> p a -> p b
- (|||) :: p va -> p va -> p va
- endOfInput :: p ()
- die :: p a
- class ProductionRule p => LiftableProductionRule p where
- epsilonL :: a -> Q Exp -> p a
- optionally :: p v -> p (Maybe v)
- epsilonLS :: (Lift v, LiftableProductionRule p) => v -> p v
- class LiftableProductionRule p => EpsProductionRule p where
- epsilon :: a -> p a
- class TokenProductionRule p t | p -> t where
- token :: t -> p (ConcreteToken t)
- anyToken :: p (ConcreteToken t)
- class PenaltyProductionRule p where
- (*>>>) :: (ProductionRule p, LiftableProductionRule p) => p a -> p b -> p b
- (>>>*) :: (ProductionRule p, LiftableProductionRule p) => p a -> p b -> p a
- ($>>) :: EpsProductionRule p => (a -> b) -> p a -> p b
- ($>>*) :: EpsProductionRule p => a -> p b -> p a
- ($|>>) :: LiftableProductionRule p => (a -> b, Q Exp) -> p a -> p b
- ($|>>*) :: LiftableProductionRule p => (a, Q Exp) -> p b -> p a
- class RecProductionRule p phi r | p -> phi, p -> r where
- ref :: phi ix -> p (r ix)
- class (ProductionRule p, LiftableProductionRule p, RecProductionRule p phi r) => LoopProductionRule p phi r | p -> phi, p -> r where
- class SuperProductionRule p where
- subref :: (DomainEmbedding phi phi' supIxT, HFunctor phi (PF phi), ProductionRule (p phi ixT r t), ProductionRule (p phi' (IxMapSeq ixT supIxT) (SubVal supIxT r) t)) => (forall ix'. phi' ix' -> p phi' (IxMapSeq ixT supIxT) (SubVal supIxT r) t (PF phi' (SubVal supIxT r) ix')) -> phi' ix -> phi (supIxT ix) -> p phi ixT r t (PF phi r (supIxT ix))
- tokenRange :: forall p t. (ProductionRule p, TokenProductionRule p t) => [t] -> p (ConcreteToken t)
- string :: forall p t. (ProductionRule p, LiftableProductionRule p, TokenProductionRule p t) => [t] -> p [ConcreteToken t]
- manyInf :: (ProductionRule p, LiftableProductionRule p) => p a -> p [a]
- many1Inf :: (ProductionRule p, LiftableProductionRule p) => p a -> p [a]
- class ProductionRuleWithLibrary p phi r | p -> phi, p -> r where
- lib :: phi ix -> p (r ix)
- class BiasedProductionRule p where
Documentation
class ProductionRule p whereSource
Base type class for production rule interpretations. A production rule
interpretation that is an instance of the ProductionRule
type class supports
sequencing and disjunction of rules, empty rules, dead rules and end-of-input
rules.
(>>>) :: p (a -> b) -> p a -> p bSource
Sequence two rules. Result of the sequenced rule is the application of the result of the first rule to the result of the second.
(|||) :: p va -> p va -> p vaSource
Disjunction of two rules.
endOfInput :: p ()Source
End of input rule. Matches only at end of input, consumes nothing, produces '()' as result.
Dead rule. Never matches.
ProductionRule (RecDecRule t) | |
Token t => ProductionRule (WrapGenParser t) | |
ProductionRule (PackratRule phi r t) | |
(Domain phi, Token t) => ProductionRule (BranchSelectorComputer phi r t) | |
Token t => ProductionRule (WrapP t loc ct) | |
ProductionRule (AssessSizeProductionRule phi r t) | |
ProductionRule (EnumTokensRule phi r t) | |
ProductionRule (IsEpsilonRule phi r t) | |
ProductionRule (LiftedRule phi r t) | |
ProductionRule (PrintProductionRule phi r t) | |
ProductionRule (GraphConstructor phi r t) | |
ProductionRule (LLRule phi ixT r t) | |
(Domain phi, Token t) => ProductionRule (FSCalculator phi ixT r t) | |
ProductionRule (RealLL1Rule phi ixT r t) | |
(ProductionRule p, EpsProductionRule p) => ProductionRule (CombineEpsilonsRule p phi r t) | |
ProductionRule p => ProductionRule (FilterDiesRule p phi r t) | |
Token t => ProductionRule (FSCalculator phi r t rr) | |
ProductionRule (IsChainNT phi r t rr) | |
(ProductionRule p, EpsProductionRule p) => ProductionRule (RuleToManyWrapper p phi r t) | |
ProductionRule (EnumerateProductionRule phi ixT r t) | |
ProductionRule (IsDeadRule phi r t rr) | |
ProductionRule p => ProductionRule (UnfoldDeadRule p phi r t) | |
ProductionRule p => ProductionRule (UnfoldLoopsWrapper p phi ixT r t) | |
ProductionRule p => ProductionRule (RPWRule p phi ixT r t) | |
(Token t, ProductionRule p, BiasedProductionRule p) => ProductionRule (IBW p phi r t rr) | |
ProductionRule p => ProductionRule (PBEHProductionRule p phi (MaybeSemanticT r) r t) | |
ProductionRule p => ProductionRule (UnfoldDepthFirstRule p phi r t rr) | |
ProductionRule (FoldReachableIntRule phi r t rr n) | |
ProductionRule p => ProductionRule (FLWrap p (FoldLoopsDomain phi) (FoldLoopsValue r) phi r t) | |
ProductionRule p => ProductionRule (IGW p phiL phiR rL rR t) | |
ProductionRule p => ProductionRule (CGW p phiL phiR rL rR t) | |
(ProductionRule p, EpsProductionRule p, RecProductionRule p (LCDomain phi t) (LCValue r t)) => ProductionRule (TransformLCRule p (LCDomain phi t) (LCValue r t) phi r t) | |
(ProductionRule p, LiftableProductionRule p) => ProductionRule (TransformUPWrapper p surrIx (UPDomain phi) (UPValue r) phi ixT r t) |
class ProductionRule p => LiftableProductionRule p whereSource
epsilonL :: a -> Q Exp -> p aSource
Epsilon rule with lifted value. Always matches, consumes nothing, produces the given value (with its lifted version) as result.
optionally :: p v -> p (Maybe v)Source
Optionally match a given rule.
epsilonLS :: (Lift v, LiftableProductionRule p) => v -> p vSource
class LiftableProductionRule p => EpsProductionRule p whereSource
Epsilon rule. Always matches, consumes nothing, produces the given value as result.
class TokenProductionRule p t | p -> t whereSource
Type class for production rules matching tokens of a certain
token type t
.
t
should be an instance of the Token
type class.
token :: t -> p (ConcreteToken t)Source
Match a given token of type t
and produce its concrete
value (of type ConcreteToken
t).
anyToken :: p (ConcreteToken t)Source
class PenaltyProductionRule p whereSource
PenaltyProductionRule (LiftedRule phi r t) | |
PenaltyProductionRule (PrintProductionRule phi r t) | |
PenaltyProductionRule p => PenaltyProductionRule (FilterDiesRule p phi r t) | |
PenaltyProductionRule (IsDeadRule phi r t rr) | |
PenaltyProductionRule p => PenaltyProductionRule (UnfoldLoopsWrapper p phi ixT r t) | |
PenaltyProductionRule p => PenaltyProductionRule (RPWRule p phi ixT r t) | |
PenaltyProductionRule p => PenaltyProductionRule (UnfoldDepthFirstRule p phi r t rr) | |
PenaltyProductionRule (FoldReachableIntRule phi r t rr n) | |
PenaltyProductionRule p => PenaltyProductionRule (TransformUPWrapper p surrIx (UPDomain phi) (UPValue r) phi ixT r t) |
(*>>>) :: (ProductionRule p, LiftableProductionRule p) => p a -> p b -> p bSource
Sequence two rules, but drop the result of the first.
(>>>*) :: (ProductionRule p, LiftableProductionRule p) => p a -> p b -> p aSource
Sequence two rules, but drop the result of the second.
($>>) :: EpsProductionRule p => (a -> b) -> p a -> p bSource
Apply a given function to the result of a given rule.
($>>*) :: EpsProductionRule p => a -> p b -> p aSource
Replace a rule's result value with a given value.
($|>>) :: LiftableProductionRule p => (a -> b, Q Exp) -> p a -> p bSource
Apply a given function to the result of a given rule.
($|>>*) :: LiftableProductionRule p => (a, Q Exp) -> p b -> p aSource
Replace a rule's result value with a given value.
class RecProductionRule p phi r | p -> phi, p -> r whereSource
Production rule interpretations supporting the RecProductionRule
type class support references
to non-terminals in a given domain phi
. The type of the result values of the rules is determined
by semantic value family r
.
RecProductionRule (PackratRule phi r t) phi r | |
(Token t, Domain phi) => RecProductionRule (BranchSelectorComputer phi r t) phi r | |
RecProductionRule (AssessSizeProductionRule phi r t) phi r | |
ShowFam phi => RecProductionRule (EnumTokensRule phi r t) phi r | |
RecProductionRule (IsEpsilonRule phi r t) phi r | |
LiftFam phi => RecProductionRule (LiftedRule phi r t) phi r | |
ShowFam phi => RecProductionRule (PrintProductionRule phi r t) phi r | |
Domain phi => RecProductionRule (GraphConstructor phi r t) phi r | |
RecProductionRule (LLRule phi ixT r t) phi r | |
(Domain phi, Token t) => RecProductionRule (FSCalculator phi ixT r t) phi r | |
RecProductionRule (RealLL1Rule phi ixT r t) phi r | |
RecProductionRule p phi r => RecProductionRule (CombineEpsilonsRule p phi r t) phi r | |
RecProductionRule p phi r => RecProductionRule (FilterDiesRule p phi r t) phi r | |
(Token t, EqFam phi) => RecProductionRule (FSCalculator phi r t rr) phi r | |
EqFam phi => RecProductionRule (IsChainNT phi r t rr) phi r | |
LoopProductionRule p phi r => RecProductionRule (RuleToManyWrapper p phi r t) phi r | |
RecProductionRule (EnumerateProductionRule phi ixT r t) phi r | |
(ProductionRule p, RecProductionRule p phi r) => RecProductionRule (UnfoldDeadRule p phi r t) phi r | |
RecProductionRule p phi r => RecProductionRule (UnfoldLoopsWrapper p phi ixT r t) phi r | |
ProductionRule p => RecProductionRule (RPWRule p phi ixT r t) phi r | |
(Token t, EqFam phi, RecProductionRule p phi r) => RecProductionRule (IBW p phi r t rr) phi r | |
SimpleRecProductionRule p phi r rr => RecProductionRule (UnfoldDepthFirstRule p phi r t rr) phi r | |
(RecProductionRule p phi (MaybeSemanticT r), LiftableProductionRule p, PenaltyProductionRule p) => RecProductionRule (PBEHProductionRule p phi (MaybeSemanticT r) r t) phi (MaybeSemanticT r) | |
(RecProductionRule p (FoldLoopsDomain phi) (FoldLoopsValue r), ProductionRule p, EpsProductionRule p) => RecProductionRule (FLWrap p (FoldLoopsDomain phi) (FoldLoopsValue r) phi r t) phi r | |
(EpsProductionRule p, ProductionRule p, RecProductionRule p (MergeDomain phiL phiR) (EitherFunctor rL rR)) => RecProductionRule (CGW p phiL phiR rL rR t) phiL rL | |
(ProductionRule p, EqFam phi, EpsProductionRule p, RecProductionRule p (LCDomain phi t) (LCValue r t)) => RecProductionRule (TransformLCRule p (LCDomain phi t) (LCValue r t) phi r t) phi r | |
(EpsProductionRule p, ProductionRule p, RecProductionRule p (MergeDomain phiL phiR) (EitherFunctor rL rR)) => RecProductionRule (IGW p phiL phiR rL rR t) (MergeDomain phiR phiL) (EitherFunctor rR rL) | |
(RecProductionRule p (UPDomain phi) (UPValue r), LiftableProductionRule p, EqFam phi, LoopProductionRule p (UPDomain phi) (UPValue r)) => RecProductionRule (TransformUPWrapper p surrIx (UPDomain phi) (UPValue r) phi ixT r t) phi r |
class (ProductionRule p, LiftableProductionRule p, RecProductionRule p phi r) => LoopProductionRule p phi r | p -> phi, p -> r whereSource
Production rule interpretations supporting the LoopProductionRule
type class allow for Kleene-star quantified references to
non-terminals (zero or more, see the manyRef
function) as well
as +
-quantified references to non-terminals (one or more, see
the many1Ref
function).
An instance can implement either manyRef or many1Ref, both or neither. Not implementing either produces old-style many and many1 combinator behaviour (discouraged for most situations)
manyRef :: phi ix -> p [r ix]Source
Match a given non-terminal zero or more times.
many1Ref :: phi ix -> p [r ix]Source
Match a given non-terminal one or more times.
class SuperProductionRule p whereSource
The 'SuperProductionRule| type class is in an experimental state, and currently not intended for general use.
subref :: (DomainEmbedding phi phi' supIxT, HFunctor phi (PF phi), ProductionRule (p phi ixT r t), ProductionRule (p phi' (IxMapSeq ixT supIxT) (SubVal supIxT r) t)) => (forall ix'. phi' ix' -> p phi' (IxMapSeq ixT supIxT) (SubVal supIxT r) t (PF phi' (SubVal supIxT r) ix')) -> phi' ix -> phi (supIxT ix) -> p phi ixT r t (PF phi r (supIxT ix))Source
tokenRange :: forall p t. (ProductionRule p, TokenProductionRule p t) => [t] -> p (ConcreteToken t)Source
Match any token in a given range of tokens.
string :: forall p t. (ProductionRule p, LiftableProductionRule p, TokenProductionRule p t) => [t] -> p [ConcreteToken t]Source
Consecutively match a given list of tokens and return their concrete token values as a list.
manyInf :: (ProductionRule p, LiftableProductionRule p) => p a -> p [a]Source
An old style many
combinator. Produces an infinite rule similar to Parsec's many rule.
Prefer to use the manyRef
function whenever possible.
many1Inf :: (ProductionRule p, LiftableProductionRule p) => p a -> p [a]Source
An old style many
combinator. Produces an infinite rule similar to Parsec's many rule.
Prefer to use the manyRef
function whenever possible.
class ProductionRuleWithLibrary p phi r | p -> phi, p -> r whereSource
(EpsProductionRule p, ProductionRule p, RecProductionRule p (MergeDomain phiL phiR) (EitherFunctor rL rR)) => ProductionRuleWithLibrary (CGW p phiL phiR rL rR t) phiR rR |
class BiasedProductionRule p whereSource
(>|||) :: p a -> p a -> p aSource
Left-biased choice
(<|||) :: p a -> p a -> p aSource
Right-biased choice
BiasedProductionRule (WrapGenParser t) | |
BiasedProductionRule (LiftedRule phi r t) | |
BiasedProductionRule (PrintProductionRule phi r t) | |
BiasedProductionRule (IsDeadRule phi r t rr) | |
BiasedProductionRule p => BiasedProductionRule (RPWRule p phi ixT r t) | |
BiasedProductionRule p => BiasedProductionRule (UnfoldDepthFirstRule p phi r t rr) | |
BiasedProductionRule (FoldReachableIntRule phi r t rr n) |