ptera-0.3.0.0: A parser generator
Safe HaskellNone
LanguageHaskell2010

Language.Parser.Ptera.Syntax.SafeGrammar

Documentation

type T = Grammar Source #

newtype Grammar action rules tokens elem initials Source #

type family TokensTag (tokens :: Type) :: [Symbol] Source #

type family RulesTag (rules :: Type) :: [Symbol] Source #

type family RuleExprType (rules :: Type) :: Type -> Type Source #

class GrammarToken tokens elem where Source #

Methods

tokenToTerminal :: Proxy tokens -> elem -> T (TokensTag tokens) Source #

fixGrammar :: forall initials action rules tokens elem. MemberInitials rules initials => Rules rules => RuleExprType rules ~ RuleExpr action rules tokens elem => rules -> Grammar action rules tokens elem initials Source #

class KnownSymbol v => HasRuleExprField rules v where Source #

Minimal complete definition

getExprField

Associated Types

type RuleExprReturnType rules v :: Type Source #

Methods

getExprField :: rules -> proxy v -> RuleExprType rules (RuleExprReturnType rules v) Source #

nonTerminalName :: rules -> proxy v -> String Source #

class MemberInitials rules initials where Source #

Methods

memberInitials :: T (DictF (HasRuleExprField rules)) initials Source #

class Rules rules where Source #

Methods

generateRules :: T (DictF (HasRuleExprField rules)) (RulesTag rules) Source #

genStartPoint :: forall initials v. Membership initials v -> StartPoint Source #

newtype RuleExpr action rules tokens elem a Source #

Constructors

RuleExpr 

Fields

newtype Alt action rules tokens elem a Source #

Constructors

UnsafeAlt 

Fields

newtype Expr rules tokens elem us Source #

Constructors

UnsafeExpr 

Fields

ruleExpr :: [Alt action rules tokens elem a] -> RuleExpr action rules tokens elem a Source #

(<^>) :: Expr rules tokens elem us1 -> Expr rules tokens elem us2 -> Expr rules tokens elem (Concat us1 us2) infixr 5 Source #

(<:>) :: Expr rules tokens elem us -> action us a -> Alt action rules tokens elem a infixl 4 Source #

eps :: Expr rules tokens elem '[] Source #

var :: KnownSymbol v => proxy v -> Expr rules tokens elem '[RuleExprReturnType rules v] Source #

varA :: forall v rules tokens elem. KnownSymbol v => Expr rules tokens elem '[RuleExprReturnType rules v] Source #

tok :: Membership (TokensTag tokens) t -> Expr rules tokens elem '[elem] Source #

class TokensMember tokens t where Source #

Methods

tokensMembership :: Proxy# '(tokens, t) -> Membership (TokensTag tokens) t Source #

tokA :: forall t rules tokens elem. TokensMember tokens t => Expr rules tokens elem '[elem] Source #