ptera-0.1.0.0: A parser generator
Safe HaskellNone
LanguageHaskell2010

Language.Parser.Ptera.Syntax

Synopsis

Documentation

type T ctx = GrammarM ctx Source #

class HasField (x :: k) r a | x r -> a where #

Constraint representing the fact that the field x belongs to the record type r and has field type a. This will be solved automatically, but manual instances may be provided as well.

Methods

getField :: r -> a #

Selector function to extract the field from the record.

class (KnownSymbol v, HasField v rules (RuleExprType rules (RuleExprReturnType rules v))) => HasRuleExprField rules v where Source #

Minimal complete definition

Nothing

Associated Types

type RuleExprReturnType rules v :: Type Source #

Methods

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

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

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

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

type GrammarM ctx = Grammar (SemActM ctx) 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 #

class GrammarToken tokens elem where Source #

Methods

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

type RuleExprM ctx = RuleExpr (SemActM ctx) Source #

type AltM ctx = Alt (SemActM ctx) Source #

data Expr rules tokens elem us Source #

data HFList (a :: k -> Type) (b :: [k]) where #

Constructors

HFNil :: forall k (a :: k -> Type). HFList a ('[] :: [k]) 
HFCons :: forall k (a :: k -> Type) (x :: k) (xs :: [k]). a x -> HFList a xs -> HFList a (x ': xs) 

data DictF (a :: k -> Constraint) (b :: k) where #

Constructors

DictF :: forall k (a :: k -> Constraint) (b :: k). a b => DictF a b 

pattern HNil :: HList '[] Source #

pattern (:*) :: u -> HList us -> HList (u ': us) infixr 6 Source #

newtype SemActM ctx us a Source #

Constructors

SemActM 

Fields

Instances

Instances details
Functor (SemActM ctx us) Source # 
Instance details

Defined in Language.Parser.Ptera.Syntax

Methods

fmap :: (a -> b) -> SemActM ctx us a -> SemActM ctx us b #

(<$) :: a -> SemActM ctx us b -> SemActM ctx us a #

semActM :: (HList us -> ActionTask ctx a) -> SemActM ctx us a Source #

newtype ActionTask ctx a Source #

Constructors

ActionTask 

Fields

Instances

Instances details
Monad (ActionTask ctx) Source # 
Instance details

Defined in Language.Parser.Ptera.Syntax

Methods

(>>=) :: ActionTask ctx a -> (a -> ActionTask ctx b) -> ActionTask ctx b #

(>>) :: ActionTask ctx a -> ActionTask ctx b -> ActionTask ctx b #

return :: a -> ActionTask ctx a #

Functor (ActionTask ctx) Source # 
Instance details

Defined in Language.Parser.Ptera.Syntax

Methods

fmap :: (a -> b) -> ActionTask ctx a -> ActionTask ctx b #

(<$) :: a -> ActionTask ctx b -> ActionTask ctx a #

Applicative (ActionTask ctx) Source # 
Instance details

Defined in Language.Parser.Ptera.Syntax

Methods

pure :: a -> ActionTask ctx a #

(<*>) :: ActionTask ctx (a -> b) -> ActionTask ctx a -> ActionTask ctx b #

liftA2 :: (a -> b -> c) -> ActionTask ctx a -> ActionTask ctx b -> ActionTask ctx c #

(*>) :: ActionTask ctx a -> ActionTask ctx b -> ActionTask ctx b #

(<*) :: ActionTask ctx a -> ActionTask ctx b -> ActionTask ctx a #

data ActionTaskResult ctx a Source #

Instances

Instances details
Functor (ActionTaskResult ctx) Source # 
Instance details

Defined in Language.Parser.Ptera.Syntax

Methods

fmap :: (a -> b) -> ActionTaskResult ctx a -> ActionTaskResult ctx b #

(<$) :: a -> ActionTaskResult ctx b -> ActionTaskResult ctx a #

(Eq a, Eq ctx) => Eq (ActionTaskResult ctx a) Source # 
Instance details

Defined in Language.Parser.Ptera.Syntax

Methods

(==) :: ActionTaskResult ctx a -> ActionTaskResult ctx a -> Bool #

(/=) :: ActionTaskResult ctx a -> ActionTaskResult ctx a -> Bool #

(Show a, Show ctx) => Show (ActionTaskResult ctx a) Source # 
Instance details

Defined in Language.Parser.Ptera.Syntax

modifyAction :: (ctx -> ctx) -> ActionTask ctx () Source #

type Alt = AltM () Source #

semAct :: (HList us -> a) -> SemActM ctx us a 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 #

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 -> (HList us -> a) -> AltM ctx rules tokens elem a infixl 4 Source #

eps :: (HList '[] -> a) -> AltM ctx rules tokens elem a Source #

(<::>) :: Expr rules tokens elem us -> (HList us -> ActionTask ctx a) -> AltM ctx rules tokens elem a infixl 4 Source #

epsM :: (HList '[] -> ActionTask ctx a) -> AltM ctx rules tokens elem a 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 #