Copyright | (c) Juan García-Garland Marcos Viera 2019 2020 |
---|---|
License | GPL |
Maintainer | jpgarcia@fing.edu.uy |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- type Rule (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) = Fam prd sc ip -> Fam prd ic sp -> Fam prd ic' sp'
- newtype CRule (ctx :: [ErrorMessage]) prd sc ip ic sp ic' sp' = CRule {}
- data Fam (prd :: Prod) (c :: [(Child, [(Att, Type)])]) (p :: [(Att, Type)]) :: Type
- chi :: Fam prd c p -> ChAttsRec prd c
- par :: Fam prd c p -> Attribution p
- syndef :: Syndef t t' ctx att sp sp' prd prd' => forall sc ip ic. Label ('Att att t) -> Label prd -> (Proxy ctx -> Fam prd' sc ip -> t') -> CRule ctx prd sc ip ic sp ic sp'
- syndefM :: Syndef t t' (MkMsg SyndefMsg att t prd nt ': ctx) att sp sp' prd prd' => Label ('Att att t) -> Label ('Prd prd nt) -> Reader (Proxy (MkMsg SyndefMsg att t prd nt ': ctx), Fam ('Prd prd' nt) sc ip) t' -> CRule ctx ('Prd prd nt) sc ip ic sp ic sp'
- syn :: Syndef t t' (MkMsg SyndefMsg att t prd nt ': ctx) att sp sp' prd prd' => Label ('Att att t) -> Label ('Prd prd nt) -> Reader (Proxy (MkMsg SyndefMsg att t prd nt ': ctx), Fam ('Prd prd' nt) sc ip) t' -> CRule ctx ('Prd prd nt) sc ip ic sp ic sp'
- synmod :: RequireR (OpUpdate AttReco ('Att att t) t r) ctx (Attribution sp') => Label ('Att att t) -> Label prd -> (Proxy ((((('Text "synmod(" :<>: ShowTE ('Att att t)) :<>: Text ", ") :<>: ShowTE prd) :<>: Text ")") ': ctx) -> Fam prd sc ip -> t) -> CRule ctx prd sc ip ic' r ic' sp'
- synmodM :: RequireR (OpUpdate AttReco ('Att att t) t r) ctx (Attribution sp') => Label ('Att att t) -> Label prd -> Reader (Proxy ((((('Text "synmod(" :<>: ShowTE ('Att att t)) :<>: Text ", ") :<>: ShowTE prd) :<>: Text ")") ': ctx), Fam prd sc ip) t -> CRule ctx prd sc ip ic' r ic' sp'
- inh :: Inhdef t t' (MkMsg InhdefMsg att t prd nt ': ctx) att r v2 prd prd' nt nt' chi ntch ic ic' n => Label ('Att att t) -> Label ('Prd prd nt) -> Label ('Chi chi ('Prd prd' nt') ntch) -> Reader (Proxy (MkMsg InhdefMsg att t prd nt ': ctx), Fam ('Prd prd nt) sc ip) t' -> CRule ctx ('Prd prd nt) sc ip ic sp ic' sp
- inhdef :: Inhdef t t' ctx att r v2 prd prd' nt nt' chi ntch ic ic' n => Label ('Att att t) -> Label ('Prd prd nt) -> Label ('Chi chi ('Prd prd' nt') ntch) -> (Proxy ctx -> Fam ('Prd prd nt) sc ip -> t') -> forall sp. CRule ctx ('Prd prd nt) sc ip ic sp ic' sp
- inhdefM :: Inhdef t t' (MkMsg InhdefMsg att t prd nt ': ctx) att r v2 prd prd' nt nt' chi ntch ic ic' n => Label ('Att att t) -> Label ('Prd prd nt) -> Label ('Chi chi ('Prd prd' nt') ntch) -> Reader (Proxy (MkMsg InhdefMsg att t prd nt ': ctx), Fam ('Prd prd nt) sc ip) t' -> CRule ctx ('Prd prd nt) sc ip ic sp ic' sp
- inhmod :: (RequireEq t t' ctx', RequireR (OpUpdate AttReco ('Att att t) t' r) ctx (Attribution v2), RequireR (OpUpdate (ChiReco ('Prd prd nt)) ('Chi chi ('Prd prd nt) ntch) v2 ic) ctx (ChAttsRec ('Prd prd nt) ic'), RequireR (OpLookup (ChiReco ('Prd prd nt)) ('Chi chi ('Prd prd nt) ntch) ic) ctx (Attribution r), ntch ~ 'Left n, ctx' ~ (((((((Text "inhmod(" :<>: ShowTE ('Att att t)) :<>: Text ", ") :<>: ShowTE ('Prd prd nt)) :<>: Text ", ") :<>: ShowTE ('Chi chi ('Prd prd nt) ntch)) :<>: Text ")") ': ctx)) => Label ('Att att t) -> Label ('Prd prd nt) -> Label ('Chi chi ('Prd prd nt) ntch) -> (Proxy ctx' -> Fam ('Prd prd nt) sc ip -> t') -> CRule ctx ('Prd prd nt) sc ip ic sp ic' sp
- inhmodM :: (RequireEq t t' ctx', RequireR (OpUpdate AttReco ('Att att t) t' r) ctx (Attribution v2), RequireR (OpUpdate (ChiReco ('Prd prd nt)) ('Chi chi ('Prd prd nt) ntch) v2 ic) ctx (ChAttsRec ('Prd prd nt) ic'), RequireR (OpLookup (ChiReco ('Prd prd nt)) ('Chi chi ('Prd prd nt) ntch) ic) ctx (Attribution r), ntch ~ 'Left n, ctx' ~ (((((((Text "inhmod(" :<>: ShowTE ('Att att t)) :<>: Text ", ") :<>: ShowTE ('Prd prd nt)) :<>: Text ", ") :<>: ShowTE ('Chi chi ('Prd prd nt) ntch)) :<>: Text ")") ': ctx)) => Label ('Att att t) -> Label ('Prd prd nt) -> Label ('Chi chi ('Prd prd nt) ntch) -> Reader (Proxy ctx', Fam ('Prd prd nt) sc ip) t' -> CRule ctx ('Prd prd nt) sc ip ic sp ic' sp
- emptyRule :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]). CRule ctx prd sc ip ic' sp' ic' sp'
- emptyRuleAtPrd :: Label prd -> CRule ctx prd sc ip ic' sp' ic' sp'
- emptyRuleInst :: KList sc -> CRule ctx prd sc ip ic sp ic sp
- ext :: RequireEq prd prd' (Text "ext" ': ctx) => CRule ctx prd sc ip ic sp ic' sp' -> CRule ctx prd' sc ip a b ic sp -> CRule ctx prd sc ip a b ic' sp'
- (.+.) :: forall (ctx :: [ErrorMessage]) (prd' :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Child, [(Att, Type)])]) (b :: [(Att, Type)]). CRule ctx prd' sc ip ic sp ic' sp' -> CRule ctx prd' sc ip a b ic sp -> CRule ctx prd' sc ip a b ic' sp'
- extP :: forall k (p :: k) (ctx :: [ErrorMessage]) (prd' :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Child, [(Att, Type)])]) (b :: [(Att, Type)]). (Proxy p -> CRule ctx prd' sc ip ic sp ic' sp') -> (Proxy p -> CRule ctx prd' sc ip a b ic sp) -> Proxy p -> CRule ctx prd' sc ip a b ic' sp'
- emptyAspect :: CAspect ctx '[]
- singAsp :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]). CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx '['(prd, CRule ctx prd sc ip ic sp ic' sp')]
- extAspect :: ExtAspect ctx prd sc ip ic sp ic' sp' a asp => CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx a -> CAspect ctx asp
- comAspect :: (Require (OpComAsp al ar) ctx, ReqR (OpComAsp al ar) ~ Aspect asp) => CAspect ctx al -> CAspect ctx ar -> CAspect ctx asp
- (.+:) :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Prod, Type)]) (asp :: [(Prod, Type)]). (Require (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ctx, ReqR (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ~ Rec PrdReco asp) => CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx a -> CAspect ctx asp
- (◃) :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Prod, Type)]) (asp :: [(Prod, Type)]). (Require (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ctx, ReqR (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ~ Rec PrdReco asp) => CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx a -> CAspect ctx asp
- (.:+.) :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Prod, Type)]) (asp :: [(Prod, Type)]). (Require (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ctx, ReqR (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ~ Rec PrdReco asp) => CAspect ctx a -> CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx asp
- (▹) :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Prod, Type)]) (asp :: [(Prod, Type)]). (Require (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ctx, ReqR (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ~ Rec PrdReco asp) => CAspect ctx a -> CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx asp
- (.:+:) :: forall (al :: [(Prod, Type)]) (ar :: [(Prod, Type)]) (ctx :: [ErrorMessage]) (asp :: [(Prod, Type)]). (Require (OpComAsp al ar) ctx, ReqR (OpComAsp al ar) ~ Aspect asp) => CAspect ctx al -> CAspect ctx ar -> CAspect ctx asp
- (⋈) :: forall (al :: [(Prod, Type)]) (ar :: [(Prod, Type)]) (ctx :: [ErrorMessage]) (asp :: [(Prod, Type)]). (Require (OpComAsp al ar) ctx, ReqR (OpComAsp al ar) ~ Aspect asp) => CAspect ctx al -> CAspect ctx ar -> CAspect ctx asp
- (.#..) :: forall (l :: Prod) (r :: [(Prod, Type)]) (ctx1 :: [ErrorMessage]) (ctx2 :: [ErrorMessage]). Require (OpLookup PrdReco l r) ('ShowType r ': ctx1) => CAspect ctx2 r -> Label l -> ReqR (OpLookup PrdReco l r)
- newtype CAspect (ctx :: [ErrorMessage]) (asp :: [(Prod, Type)]) = CAspect {}
- data Label (l :: k) = Label
- data Prod = Prd Symbol NT
- data T = T Type
- data NT = NT Symbol
- data Child = Chi Symbol Prod (Either NT T)
- data Att = Att Symbol Type
- (.#) :: (c ~ 'Chi ch prd nt, ctx ~ '[((Text "looking up " :<>: ShowTE c) :$$: (Text "on " :<>: ShowTE r)) :$$: (Text "producion: " :<>: ShowTE prd)], Require (OpLookup (ChiReco prd) c r) ctx) => Rec (ChiReco prd) r -> Label c -> ReqR (OpLookup (ChiReco prd) c r)
- (#.) :: (msg ~ '[(Text "looking up attribute " :<>: ShowTE l) :$$: (Text "on " :<>: ShowTE r)], Require (OpLookup AttReco l r) msg) => Attribution r -> Label l -> ReqR (OpLookup AttReco l r)
- (=.) :: Label l -> v -> Attribute l v
- (.=) :: Label l -> WrapField (ChiReco prd) v -> TaggedChAttr prd l v
- (.*) :: forall (prd :: Prod) (ch :: Child) (attrib :: [(Att, Type)]) (attribs :: [(Child, [(Att, Type)])]). Require (OpExtend (ChiReco prd) ch attrib attribs) '['Text ""] => TaggedChAttr prd ch attrib -> ChAttsRec prd attribs -> ReqR (OpExtend (ChiReco prd) ch attrib attribs)
- (*.) :: forall (att :: Att) val (atts :: [(Att, Type)]). Require (OpExtend AttReco att val atts) '['Text ""] => Attribute att val -> Attribution atts -> ReqR (OpExtend AttReco att val atts)
- emptyAtt :: Attribution '[]
- ter :: (RequireR (OpLookup (ChiReco prd) pos chi) ctx (Attribution r), RequireR (OpLookup AttReco ('Att "term" t) r) ctx t, RequireEqWithMsg prd prd' PrdTypeMatch ctx, ReqR (OpLookup AttReco ('Att "term" t) (UnWrap @Att @Type (Attribution r))) ~ t, RequireEq pos ('Chi ch prd rtt) ctx, RequireEq rtt (Right ('T t)) ctx) => Label pos -> Reader (Proxy ctx, Fam prd' chi par) t
- at :: At pos att m => Label pos -> Label att -> m (ResAt pos att m)
- lhs :: Label Lhs
- sem_Lit :: SemLit a => a -> Attribution ('[] :: [(Att, Type)]) -> Attribution '['('Att "term" a, a)]
- knitAspect :: forall (fc :: [(Child, Type)]) (prd1 :: Prod) (prd2 :: Prod) (r :: [(Prod, Type)]) (ip :: [(Att, Type)]) (sp :: [(Att, Type)]). (Empties fc prd1, Kn fc prd1, Require (OpLookup PrdReco prd2 r) '['Text (AppendSymbol "knit:" (FromEM (ShowTE prd2)))], ReqR (OpLookup PrdReco prd2 r) ~ CRule ('[] :: [ErrorMessage]) prd1 (SCh fc) ip (EmptiesR fc) ('[] :: [(Att, Type)]) (ICh fc) sp) => Label prd2 -> CAspect ('[] :: [ErrorMessage]) r -> Record fc -> Attribution ip -> Attribution sp
- knit :: forall (fc :: [(Child, Type)]) (prd :: Prod) (ctx :: [ErrorMessage]) (ip :: [(Att, Type)]) (sp :: [(Att, Type)]). (Empties fc prd, Kn fc prd) => Proxy ctx -> CRule ctx prd (SCh fc) ip (EmptiesR fc) ('[] :: [(Att, Type)]) (ICh fc) sp -> Record fc -> Attribution ip -> Attribution sp
- traceAspect :: forall (r :: [(Prod, Type)]) (ctx :: [ErrorMessage]) (e :: ErrorMessage). MapCtxAsp r ctx (('Text "- traceAspect: " :<>: e) ': ctx) => Proxy e -> CAspect (('Text "- traceAspect: " :<>: e) ': ctx) r -> CAspect ctx (ResMapCtx r ctx (('Text "- traceAspect: " :<>: e) ': ctx))
- traceRule :: forall (e :: ErrorMessage) (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]). Proxy e -> CRule (('Text "- traceRule: " :<>: e) ': ctx) prd sc ip ic sp ic' sp' -> CRule ctx prd sc ip ic sp ic' sp'
- copyAtChi :: forall (prd' :: Symbol) (nt' :: NT) (chi :: Symbol) (ntch :: Either NT T) (v2 :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (ctx :: [ErrorMessage]) (att :: Symbol) t' (r :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (sp :: [(Att, Type)]). (Require (OpUpdate (ChiReco ('Prd prd' nt')) ('Chi chi ('Prd prd' nt') ntch) v2 ic) ctx, Require (OpExtend AttReco ('Att att t') t' r) ctx, Require (OpLookup (ChiReco ('Prd prd' nt')) ('Chi chi ('Prd prd' nt') ntch) ic) ctx, At Lhs ('Att att t') ((->) (Proxy ctx) :: Type -> Type), ReqR (OpExtend AttReco ('Att att t') t' r) ~ Attribution v2, ReqR (OpUpdate (ChiReco ('Prd prd' nt')) ('Chi chi ('Prd prd' nt') ntch) v2 ic) ~ ChAttsRec ('Prd prd' nt') ic', ResAt Lhs ('Att att t') ((->) (Proxy ctx) :: Type -> Type) ~ (Fam ('Prd prd' nt') sc ip -> t'), ReqR (OpLookup (ChiReco ('Prd prd' nt')) ('Chi chi ('Prd prd' nt') ntch) ic) ~ Attribution r) => Label ('Att att t') -> Label ('Chi chi ('Prd prd' nt') ntch) -> CRule ctx ('Prd prd' nt') sc ip ic sp ic' sp
- emptyAspectC :: EmptyAspect prds polyArgs ctx => KList prds -> Proxy polyArgs -> CAspect ctx (EmptyAspectR prds polyArgs ctx)
- emptyAspectForProds :: forall (prds :: [Prod]) (polyArgs :: [([(Child, [(Att, Type)])], [(Att, Type)], [(Child, [(Att, Type)])], [(Att, Type)])]) (ctx :: [ErrorMessage]). EmptyAspect prds polyArgs ctx => KList prds -> CAspect ctx (EmptyAspectR prds polyArgs ctx)
- module Data.GenRec
- module Language.Grammars.AspectAG.HList
- type family Terminal s :: Either NT T where ...
- type family NonTerminal s where ...
- (+++) :: Proxy e1 -> Proxy e2 -> Proxy (e1 :$$: e2)
- empties :: Empties fc prd => Record fc -> ChAttsRec prd (EmptiesR fc)
Rules
type Rule (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) = Fam prd sc ip -> Fam prd ic sp -> Fam prd ic' sp' Source #
Rules are a function from the input family to the output family, with an extra arity to make them composable. They are indexed by a production.
newtype CRule (ctx :: [ErrorMessage]) prd sc ip ic sp ic' sp' Source #
Rules with context (used to print domain specific type errors).
data Fam (prd :: Prod) (c :: [(Child, [(Att, Type)])]) (p :: [(Att, Type)]) :: Type Source #
In each node of the grammar, the Fam contains a single attribution for the parent, and a collection (Record) of attributions for the children:
par :: Fam prd c p -> Attribution p Source #
getter
Defining Rules
syndef :: Syndef t t' ctx att sp sp' prd prd' => forall sc ip ic. Label ('Att att t) -> Label prd -> (Proxy ctx -> Fam prd' sc ip -> t') -> CRule ctx prd sc ip ic sp ic sp' Source #
The function syndef
adds the definition of a synthesized
attribute. It takes an attribute label att
representing the
name of the new attribute; a production label prd
representing
the production where the rule is defined; a value t'
to be
assigned to this attribute, given a context and an input
family. It updates the output constructed thus far.
syndefM :: Syndef t t' (MkMsg SyndefMsg att t prd nt ': ctx) att sp sp' prd prd' => Label ('Att att t) -> Label ('Prd prd nt) -> Reader (Proxy (MkMsg SyndefMsg att t prd nt ': ctx), Fam ('Prd prd' nt) sc ip) t' -> CRule ctx ('Prd prd nt) sc ip ic sp ic sp' Source #
syn :: Syndef t t' (MkMsg SyndefMsg att t prd nt ': ctx) att sp sp' prd prd' => Label ('Att att t) -> Label ('Prd prd nt) -> Reader (Proxy (MkMsg SyndefMsg att t prd nt ': ctx), Fam ('Prd prd' nt) sc ip) t' -> CRule ctx ('Prd prd nt) sc ip ic sp ic sp' Source #
This is simply an alias for syndef
synmod :: RequireR (OpUpdate AttReco ('Att att t) t r) ctx (Attribution sp') => Label ('Att att t) -> Label prd -> (Proxy ((((('Text "synmod(" :<>: ShowTE ('Att att t)) :<>: Text ", ") :<>: ShowTE prd) :<>: Text ")") ': ctx) -> Fam prd sc ip -> t) -> CRule ctx prd sc ip ic' r ic' sp' Source #
synthesized poly rule synP (att :: forall v. Label ('Att k v)) prd rul = (p :: Proxy p) -> syndefM (att @ p) prd rul
This is simply an alias for inhdefM
inh = inhdefM
synmodM :: RequireR (OpUpdate AttReco ('Att att t) t r) ctx (Attribution sp') => Label ('Att att t) -> Label prd -> Reader (Proxy ((((('Text "synmod(" :<>: ShowTE ('Att att t)) :<>: Text ", ") :<>: ShowTE prd) :<>: Text ")") ': ctx), Fam prd sc ip) t -> CRule ctx prd sc ip ic' r ic' sp' Source #
inh :: Inhdef t t' (MkMsg InhdefMsg att t prd nt ': ctx) att r v2 prd prd' nt nt' chi ntch ic ic' n => Label ('Att att t) -> Label ('Prd prd nt) -> Label ('Chi chi ('Prd prd' nt') ntch) -> Reader (Proxy (MkMsg InhdefMsg att t prd nt ': ctx), Fam ('Prd prd nt) sc ip) t' -> CRule ctx ('Prd prd nt) sc ip ic sp ic' sp Source #
inhdef :: Inhdef t t' ctx att r v2 prd prd' nt nt' chi ntch ic ic' n => Label ('Att att t) -> Label ('Prd prd nt) -> Label ('Chi chi ('Prd prd' nt') ntch) -> (Proxy ctx -> Fam ('Prd prd nt) sc ip -> t') -> forall sp. CRule ctx ('Prd prd nt) sc ip ic sp ic' sp Source #
inhdefM :: Inhdef t t' (MkMsg InhdefMsg att t prd nt ': ctx) att r v2 prd prd' nt nt' chi ntch ic ic' n => Label ('Att att t) -> Label ('Prd prd nt) -> Label ('Chi chi ('Prd prd' nt') ntch) -> Reader (Proxy (MkMsg InhdefMsg att t prd nt ': ctx), Fam ('Prd prd nt) sc ip) t' -> CRule ctx ('Prd prd nt) sc ip ic sp ic' sp Source #
inhmod :: (RequireEq t t' ctx', RequireR (OpUpdate AttReco ('Att att t) t' r) ctx (Attribution v2), RequireR (OpUpdate (ChiReco ('Prd prd nt)) ('Chi chi ('Prd prd nt) ntch) v2 ic) ctx (ChAttsRec ('Prd prd nt) ic'), RequireR (OpLookup (ChiReco ('Prd prd nt)) ('Chi chi ('Prd prd nt) ntch) ic) ctx (Attribution r), ntch ~ 'Left n, ctx' ~ (((((((Text "inhmod(" :<>: ShowTE ('Att att t)) :<>: Text ", ") :<>: ShowTE ('Prd prd nt)) :<>: Text ", ") :<>: ShowTE ('Chi chi ('Prd prd nt) ntch)) :<>: Text ")") ': ctx)) => Label ('Att att t) -> Label ('Prd prd nt) -> Label ('Chi chi ('Prd prd nt) ntch) -> (Proxy ctx' -> Fam ('Prd prd nt) sc ip -> t') -> CRule ctx ('Prd prd nt) sc ip ic sp ic' sp Source #
inhmodM :: (RequireEq t t' ctx', RequireR (OpUpdate AttReco ('Att att t) t' r) ctx (Attribution v2), RequireR (OpUpdate (ChiReco ('Prd prd nt)) ('Chi chi ('Prd prd nt) ntch) v2 ic) ctx (ChAttsRec ('Prd prd nt) ic'), RequireR (OpLookup (ChiReco ('Prd prd nt)) ('Chi chi ('Prd prd nt) ntch) ic) ctx (Attribution r), ntch ~ 'Left n, ctx' ~ (((((((Text "inhmod(" :<>: ShowTE ('Att att t)) :<>: Text ", ") :<>: ShowTE ('Prd prd nt)) :<>: Text ", ") :<>: ShowTE ('Chi chi ('Prd prd nt) ntch)) :<>: Text ")") ': ctx)) => Label ('Att att t) -> Label ('Prd prd nt) -> Label ('Chi chi ('Prd prd nt) ntch) -> Reader (Proxy ctx', Fam ('Prd prd nt) sc ip) t' -> CRule ctx ('Prd prd nt) sc ip ic sp ic' sp Source #
emptyRule :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]). CRule ctx prd sc ip ic' sp' ic' sp' Source #
emptyRuleAtPrd :: Label prd -> CRule ctx prd sc ip ic' sp' ic' sp' Source #
emptyRuleInst :: KList sc -> CRule ctx prd sc ip ic sp ic sp Source #
ext :: RequireEq prd prd' (Text "ext" ': ctx) => CRule ctx prd sc ip ic sp ic' sp' -> CRule ctx prd' sc ip a b ic sp -> CRule ctx prd sc ip a b ic' sp' Source #
Given two rules for a given (the same) production, it combines
them. Note that the production equality is visible in the context,
not sintactically. This is a use of the Require
pattern.
(.+.) :: forall (ctx :: [ErrorMessage]) (prd' :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Child, [(Att, Type)])]) (b :: [(Att, Type)]). CRule ctx prd' sc ip ic sp ic' sp' -> CRule ctx prd' sc ip a b ic sp -> CRule ctx prd' sc ip a b ic' sp' infixr 6 Source #
extP :: forall k (p :: k) (ctx :: [ErrorMessage]) (prd' :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Child, [(Att, Type)])]) (b :: [(Att, Type)]). (Proxy p -> CRule ctx prd' sc ip ic sp ic' sp') -> (Proxy p -> CRule ctx prd' sc ip a b ic sp) -> Proxy p -> CRule ctx prd' sc ip a b ic' sp' Source #
extension of polymorphic rules
Aspects
Building Aspects.
emptyAspect :: CAspect ctx '[] Source #
Recall that Aspects are mappings from productions to rules. They have a record-like interface to build them. This is the constructor for the empty Aspect.
singAsp :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]). CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx '['(prd, CRule ctx prd sc ip ic sp ic' sp')] Source #
Singleton Aspect. Wraps a rule to build an Aspect from it.
extAspect :: ExtAspect ctx prd sc ip ic sp ic' sp' a asp => CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx a -> CAspect ctx asp Source #
comAspect :: (Require (OpComAsp al ar) ctx, ReqR (OpComAsp al ar) ~ Aspect asp) => CAspect ctx al -> CAspect ctx ar -> CAspect ctx asp Source #
combination of two Aspects. It merges them. When both aspects
have rules for a given production, in the resulting Aspect the rule
at that field is the combination of the rules for the arguments
(with ext
).
(.+:) :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Prod, Type)]) (asp :: [(Prod, Type)]). (Require (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ctx, ReqR (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ~ Rec PrdReco asp) => CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx a -> CAspect ctx asp infixr 3 Source #
An operator, alias for extAspect
. It combines a rule with an
aspect, to build a bigger one.
(◃) :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Prod, Type)]) (asp :: [(Prod, Type)]). (Require (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ctx, ReqR (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ~ Rec PrdReco asp) => CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx a -> CAspect ctx asp infixr 3 Source #
(.:+.) :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Prod, Type)]) (asp :: [(Prod, Type)]). (Require (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ctx, ReqR (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ~ Rec PrdReco asp) => CAspect ctx a -> CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx asp infixl 3 Source #
(▹) :: forall (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]) (a :: [(Prod, Type)]) (asp :: [(Prod, Type)]). (Require (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ctx, ReqR (OpComRA ctx prd (CRule ctx prd sc ip ic sp ic' sp') a) ~ Rec PrdReco asp) => CAspect ctx a -> CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx asp infixl 3 Source #
Unicode operator for .:+.
or `flip extAspect`.
(.:+:) :: forall (al :: [(Prod, Type)]) (ar :: [(Prod, Type)]) (ctx :: [ErrorMessage]) (asp :: [(Prod, Type)]). (Require (OpComAsp al ar) ctx, ReqR (OpComAsp al ar) ~ Aspect asp) => CAspect ctx al -> CAspect ctx ar -> CAspect ctx asp infixr 4 Source #
(⋈) :: forall (al :: [(Prod, Type)]) (ar :: [(Prod, Type)]) (ctx :: [ErrorMessage]) (asp :: [(Prod, Type)]). (Require (OpComAsp al ar) ctx, ReqR (OpComAsp al ar) ~ Aspect asp) => CAspect ctx al -> CAspect ctx ar -> CAspect ctx asp infixr 4 Source #
(.#..) :: forall (l :: Prod) (r :: [(Prod, Type)]) (ctx1 :: [ErrorMessage]) (ctx2 :: [ErrorMessage]). Require (OpLookup PrdReco l r) ('ShowType r ': ctx1) => CAspect ctx2 r -> Label l -> ReqR (OpLookup PrdReco l r) Source #
newtype CAspect (ctx :: [ErrorMessage]) (asp :: [(Prod, Type)]) Source #
Instances
OrdType Prod Source # | |
Defined in Language.Grammars.AspectAG.RecordInstances | |
type ShowTE ('Prd l nt :: Prod) Source # | |
Defined in Language.Grammars.AspectAG.RecordInstances type ShowTE ('Prd l nt :: Prod) = 'Text (AppendSymbol (AppendSymbol (AppendSymbol (AppendSymbol "(" l) " of ") (FromEM (ShowTE nt))) ")") | |
type Cmp ('Prd a _1 :: Prod) ('Prd b _2 :: Prod) Source # | |
Instances
OrdType Child Source # | |
Defined in Language.Grammars.AspectAG.RecordInstances | |
type ShowTE ('Chi l p s :: Child) Source # | |
Defined in Language.Grammars.AspectAG.RecordInstances type ShowTE ('Chi l p s :: Child) = 'Text (AppendSymbol (AppendSymbol (AppendSymbol "Child " l) " of producion ") (FromEM (ShowTE p))) | |
type Cmp ('Chi a _1 _2 :: Child) ('Chi b _3 _4 :: Child) Source # | |
Instances
OrdType Att Source # | |
Defined in Language.Grammars.AspectAG.RecordInstances | |
type UnWrap (Attribution r) Source # | |
Defined in Language.Grammars.AspectAG | |
type UnWrap (Rec c r) Source # | |
Defined in Language.Grammars.AspectAG | |
type ShowTE ('Att l t :: Att) Source # | |
Defined in Language.Grammars.AspectAG.RecordInstances type ShowTE ('Att l t :: Att) = 'Text (AppendSymbol (AppendSymbol (AppendSymbol (AppendSymbol "(" l) ":") (FromEM (ShowTE t))) ")") | |
type Cmp ('Att a _1 :: Att) ('Att b _2 :: Att) Source # | |
type WrapField (ChiReco prd :: Type) (v :: [(Att, Type)]) Source # | Field type |
Defined in Language.Grammars.AspectAG.RecordInstances |
(.#) :: (c ~ 'Chi ch prd nt, ctx ~ '[((Text "looking up " :<>: ShowTE c) :$$: (Text "on " :<>: ShowTE r)) :$$: (Text "producion: " :<>: ShowTE prd)], Require (OpLookup (ChiReco prd) c r) ctx) => Rec (ChiReco prd) r -> Label c -> ReqR (OpLookup (ChiReco prd) c r) infixl 8 Source #
(#.) :: (msg ~ '[(Text "looking up attribute " :<>: ShowTE l) :$$: (Text "on " :<>: ShowTE r)], Require (OpLookup AttReco l r) msg) => Attribution r -> Label l -> ReqR (OpLookup AttReco l r) infixl 7 Source #
(.=) :: Label l -> WrapField (ChiReco prd) v -> TaggedChAttr prd l v infixr 4 Source #
Pretty constructor for tagging a child
(.*) :: forall (prd :: Prod) (ch :: Child) (attrib :: [(Att, Type)]) (attribs :: [(Child, [(Att, Type)])]). Require (OpExtend (ChiReco prd) ch attrib attribs) '['Text ""] => TaggedChAttr prd ch attrib -> ChAttsRec prd attribs -> ReqR (OpExtend (ChiReco prd) ch attrib attribs) infixr 2 Source #
Pretty constructors
(*.) :: forall (att :: Att) val (atts :: [(Att, Type)]). Require (OpExtend AttReco att val atts) '['Text ""] => Attribute att val -> Attribution atts -> ReqR (OpExtend AttReco att val atts) infixr 2 Source #
Extending
emptyAtt :: Attribution '[] Source #
Empty
ter :: (RequireR (OpLookup (ChiReco prd) pos chi) ctx (Attribution r), RequireR (OpLookup AttReco ('Att "term" t) r) ctx t, RequireEqWithMsg prd prd' PrdTypeMatch ctx, ReqR (OpLookup AttReco ('Att "term" t) (UnWrap @Att @Type (Attribution r))) ~ t, RequireEq pos ('Chi ch prd rtt) ctx, RequireEq rtt (Right ('T t)) ctx) => Label pos -> Reader (Proxy ctx, Fam prd' chi par) t Source #
sem_Lit :: SemLit a => a -> Attribution ('[] :: [(Att, Type)]) -> Attribution '['('Att "term" a, a)] Source #
knitAspect :: forall (fc :: [(Child, Type)]) (prd1 :: Prod) (prd2 :: Prod) (r :: [(Prod, Type)]) (ip :: [(Att, Type)]) (sp :: [(Att, Type)]). (Empties fc prd1, Kn fc prd1, Require (OpLookup PrdReco prd2 r) '['Text (AppendSymbol "knit:" (FromEM (ShowTE prd2)))], ReqR (OpLookup PrdReco prd2 r) ~ CRule ('[] :: [ErrorMessage]) prd1 (SCh fc) ip (EmptiesR fc) ('[] :: [(Att, Type)]) (ICh fc) sp) => Label prd2 -> CAspect ('[] :: [ErrorMessage]) r -> Record fc -> Attribution ip -> Attribution sp Source #
knit :: forall (fc :: [(Child, Type)]) (prd :: Prod) (ctx :: [ErrorMessage]) (ip :: [(Att, Type)]) (sp :: [(Att, Type)]). (Empties fc prd, Kn fc prd) => Proxy ctx -> CRule ctx prd (SCh fc) ip (EmptiesR fc) ('[] :: [(Att, Type)]) (ICh fc) sp -> Record fc -> Attribution ip -> Attribution sp Source #
traceAspect :: forall (r :: [(Prod, Type)]) (ctx :: [ErrorMessage]) (e :: ErrorMessage). MapCtxAsp r ctx (('Text "- traceAspect: " :<>: e) ': ctx) => Proxy e -> CAspect (('Text "- traceAspect: " :<>: e) ': ctx) r -> CAspect ctx (ResMapCtx r ctx (('Text "- traceAspect: " :<>: e) ': ctx)) Source #
|traceAspect| adds context to an aspect.
traceRule :: forall (e :: ErrorMessage) (ctx :: [ErrorMessage]) (prd :: Prod) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (sp :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sp' :: [(Att, Type)]). Proxy e -> CRule (('Text "- traceRule: " :<>: e) ': ctx) prd sc ip ic sp ic' sp' -> CRule ctx prd sc ip ic sp ic' sp' Source #
copyAtChi :: forall (prd' :: Symbol) (nt' :: NT) (chi :: Symbol) (ntch :: Either NT T) (v2 :: [(Att, Type)]) (ic :: [(Child, [(Att, Type)])]) (ctx :: [ErrorMessage]) (att :: Symbol) t' (r :: [(Att, Type)]) (ic' :: [(Child, [(Att, Type)])]) (sc :: [(Child, [(Att, Type)])]) (ip :: [(Att, Type)]) (sp :: [(Att, Type)]). (Require (OpUpdate (ChiReco ('Prd prd' nt')) ('Chi chi ('Prd prd' nt') ntch) v2 ic) ctx, Require (OpExtend AttReco ('Att att t') t' r) ctx, Require (OpLookup (ChiReco ('Prd prd' nt')) ('Chi chi ('Prd prd' nt') ntch) ic) ctx, At Lhs ('Att att t') ((->) (Proxy ctx) :: Type -> Type), ReqR (OpExtend AttReco ('Att att t') t' r) ~ Attribution v2, ReqR (OpUpdate (ChiReco ('Prd prd' nt')) ('Chi chi ('Prd prd' nt') ntch) v2 ic) ~ ChAttsRec ('Prd prd' nt') ic', ResAt Lhs ('Att att t') ((->) (Proxy ctx) :: Type -> Type) ~ (Fam ('Prd prd' nt') sc ip -> t'), ReqR (OpLookup (ChiReco ('Prd prd' nt')) ('Chi chi ('Prd prd' nt') ntch) ic) ~ Attribution r) => Label ('Att att t') -> Label ('Chi chi ('Prd prd' nt') ntch) -> CRule ctx ('Prd prd' nt') sc ip ic sp ic' sp Source #
a rule to copy one attribute att
from the parent to the children chi
emptyAspectC :: EmptyAspect prds polyArgs ctx => KList prds -> Proxy polyArgs -> CAspect ctx (EmptyAspectR prds polyArgs ctx) Source #
emptyAspectForProds :: forall (prds :: [Prod]) (polyArgs :: [([(Child, [(Att, Type)])], [(Att, Type)], [(Child, [(Att, Type)])], [(Att, Type)])]) (ctx :: [ErrorMessage]). EmptyAspect prds polyArgs ctx => KList prds -> CAspect ctx (EmptyAspectR prds polyArgs ctx) Source #
module Data.GenRec
type family NonTerminal s where ... Source #
NonTerminal s = 'Left s |