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 {}
- syndef :: Syndef t t' ctx ctx' att sp sp' 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' ctx ctx' att sp sp' prd => Label (Att att t) -> Label prd -> Reader (Proxy ctx', Fam prd sc ip) t' -> CRule ctx prd sc ip ic sp ic sp'
- syn :: (Require (OpExtend AttReco (Att att t') t' sp) ctx, ReqR (OpExtend AttReco (Att att t') t' sp) ~# Rec AttReco sp') => Label (Att att t') -> Label prd -> Reader (Proxy (((((Text "syndef(" :<>: (((Text "Attribute " :<>: Text att) :<>: Text ":") :<>: ShowType t')) :<>: Text ", ") :<>: ShowTE prd) :<>: Text ")") ': ctx), Fam prd sc ip) t' -> CRule ctx prd 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 :: (Require (OpExtend AttReco (Att att t') t' r) ctx, Require (OpUpdate (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) v2 ic) ctx, Require (OpLookup (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) ic) ctx, ReqR (OpLookup (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) ic) ~# Rec AttReco r, ReqR (OpExtend AttReco (Att att t') t' r) ~# Rec AttReco v2, ReqR (OpUpdate (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) v2 ic) ~# Rec (ChiReco (Prd prd nt)) ic') => Label (Att att t') -> Label (Prd prd nt) -> Label (Chi chi (Prd prd nt) (Left n :: Either NT T)) -> Reader (Proxy (((((((Text "inhdef(" :<>: (((Text "Attribute " :<>: Text att) :<>: Text ":") :<>: ShowType t')) :<>: Text ", ") :<>: ((ShowTE nt :<>: Text "::Production ") :<>: Text prd)) :<>: Text ", ") :<>: ((((((ShowTE nt :<>: Text "::Production ") :<>: Text prd) :<>: Text "::Child ") :<>: Text chi) :<>: Text ":") :<>: ShowTE n)) :<>: Text ")") ': ctx), Fam (Prd prd nt) sc ip) t' -> CRule ctx (Prd prd nt) sc ip ic sp ic' sp
- inhdef :: Inhdef t t' ctx ctx' att r v2 prd 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' ctx ctx' att r v2 prd nt chi ntch ic ic' n => 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
- 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), RequireEq ntch (Left n) ctx', 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), RequireEq ntch (Left n) ctx', 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 :: CRule ctx prd sc ip ic' sp' ic' sp'
- emptyRuleAtPrd :: Label prd -> 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'
- emptyAspect :: CAspect ctx '[]
- singAsp :: CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx ((,) prd (CRule ctx prd sc ip ic sp ic' sp') ': ([] :: [(Prod, Type)]))
- 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
- (.+:) :: (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
- (◃) :: (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
- (.:+.) :: (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
- (▹) :: (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
- (.:+:) :: (Require (OpComAsp al ar) ctx, ReqR (OpComAsp al ar) ~# Rec PrdReco asp) => CAspect ctx al -> CAspect ctx ar -> CAspect ctx asp
- (⋈) :: (Require (OpComAsp al ar) ctx, ReqR (OpComAsp al ar) ~# Rec PrdReco asp) => CAspect ctx al -> CAspect ctx ar -> CAspect ctx asp
- newtype CAspect (ctx :: [ErrorMessage]) (asp :: [(Prod, Type)]) = CAspect {}
- data Label (l :: k) :: forall k. k -> Type = 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
- (.*) :: Require (OpExtend (ChiReco prd) ch attrib attribs) (Text "" ': ([] :: [ErrorMessage])) => TaggedChAttr prd ch attrib -> ChAttsRec prd attribs -> ReqR (OpExtend (ChiReco prd) ch attrib attribs)
- (*.) :: Require (OpExtend AttReco att val atts) (Text "" ': ([] :: [ErrorMessage])) => 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', RequireEq prd prd' ctx, RequireEq t t' ctx, RequireEq pos (Chi ch prd (Right (T t))) ctx, m ~ Reader (Proxy ctx, Fam prd' chi par)) => Label pos -> m (ResAt pos (Att "term" t) m)
- 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 :: (Empties fc prd1, Kn fc prd1, Require (OpLookup PrdReco prd2 r) ((Text "knit" :<>: ShowTE prd2) ': ([] :: [ErrorMessage])), 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
- traceAspect :: MapCtxAsp r ctx ((Text "aspect " :<>: e) ': ctx) => Proxy e -> CAspect ((Text "aspect " :<>: e) ': ctx) r -> CAspect ctx (ResMapCtx r ctx ((Text "aspect " :<>: e) ': ctx))
- traceRule :: Proxy e -> CRule ((Text "rule " :<>: e) ': ctx) prd sc ip ic sp ic' sp' -> CRule ctx prd sc ip ic sp ic' sp'
- copyAtChi :: (Require (OpUpdate (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) v2 ic) ctx, Require (OpExtend AttReco (Att att t') t' r) ctx, Require (OpLookup (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) ic) ctx, Require (OpLookup AttReco (Att att t') ip) (((((((Text "inhdef(" :<>: (((Text "Attribute " :<>: Text att) :<>: Text ":") :<>: ShowType t')) :<>: Text ", ") :<>: ((ShowTE nt :<>: Text "::Production ") :<>: Text prd)) :<>: Text ", ") :<>: ((((((ShowTE nt :<>: Text "::Production ") :<>: Text prd) :<>: Text "::Child ") :<>: Text chi) :<>: Text ":") :<>: ShowTE n)) :<>: Text ")") ': ctx), ReqR (OpLookup AttReco (Att att t') ip) ~# t', ReqR (OpExtend AttReco (Att att t') t' r) ~# Rec AttReco v2, ReqR (OpLookup (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) ic) ~# Rec AttReco r, ReqR (OpUpdate (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) v2 ic) ~# Rec (ChiReco (Prd prd nt)) ic') => Label (Att att t') -> Label (Chi chi (Prd prd nt) (Left n :: Either NT T)) -> CRule ctx (Prd prd nt) sc ip ic sp ic' sp
- use :: UseC att prd nts t' sp sc sp' ctx => Label (Att att t') -> Label prd -> KList nts -> (t' -> t' -> t') -> t' -> forall ip ic'. CRule ctx prd sc ip ic' sp ic' sp'
- emptyAspectC :: EmptyAspect prds polyArgs ctx => KList prds -> Proxy polyArgs -> CAspect ctx (EmptyAspectR prds polyArgs ctx)
- emptyAspectForProds :: EmptyAspect prds polyArgs ctx => KList prds -> CAspect ctx (EmptyAspectR prds polyArgs ctx)
- module Data.GenRec
- module Language.Grammars.AspectAG.HList
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).
Defining Rules
syndef :: Syndef t t' ctx ctx' att sp sp' 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' ctx ctx' att sp sp' prd => Label (Att att t) -> Label prd -> Reader (Proxy ctx', Fam prd sc ip) t' -> CRule ctx prd sc ip ic sp ic sp' Source #
As syndef
, the function syndefM
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. This
function captures the monadic behaviour of the family
updating. For instance, the following definition specifies a rule
for an attribute `att_size :: Label (Att "size" Int)` at the
prduction `p_cons :: Label (Prd "cons" (NT List))`. The value
is computed from the very same attribute value at a child
`ch_tail :: Chi "tail" (Prd "cons" (NT List) (Left NT))`
foo = syndefM att_size p_cons $ do sizeatchi <- at ch_tail att_size return (sizeatchi + 1)
syn :: (Require (OpExtend AttReco (Att att t') t' sp) ctx, ReqR (OpExtend AttReco (Att att t') t' sp) ~# Rec AttReco sp') => Label (Att att t') -> Label prd -> Reader (Proxy (((((Text "syndef(" :<>: (((Text "Attribute " :<>: Text att) :<>: Text ":") :<>: ShowType t')) :<>: Text ", ") :<>: ShowTE prd) :<>: Text ")") ': ctx), Fam prd sc ip) t' -> CRule ctx prd sc ip ic sp ic sp' Source #
This is simply an alias for syndefM
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 #
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 :: (Require (OpExtend AttReco (Att att t') t' r) ctx, Require (OpUpdate (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) v2 ic) ctx, Require (OpLookup (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) ic) ctx, ReqR (OpLookup (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) ic) ~# Rec AttReco r, ReqR (OpExtend AttReco (Att att t') t' r) ~# Rec AttReco v2, ReqR (OpUpdate (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) v2 ic) ~# Rec (ChiReco (Prd prd nt)) ic') => Label (Att att t') -> Label (Prd prd nt) -> Label (Chi chi (Prd prd nt) (Left n :: Either NT T)) -> Reader (Proxy (((((((Text "inhdef(" :<>: (((Text "Attribute " :<>: Text att) :<>: Text ":") :<>: ShowType t')) :<>: Text ", ") :<>: ((ShowTE nt :<>: Text "::Production ") :<>: Text prd)) :<>: Text ", ") :<>: ((((((ShowTE nt :<>: Text "::Production ") :<>: Text prd) :<>: Text "::Child ") :<>: Text chi) :<>: Text ":") :<>: ShowTE n)) :<>: Text ")") ': 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 inhdefM
inhdef :: Inhdef t t' ctx ctx' att r v2 prd 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' ctx ctx' att r v2 prd nt chi ntch ic ic' n => 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 #
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), RequireEq ntch (Left n) ctx', 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), RequireEq ntch (Left n) ctx', 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 #
emptyRuleAtPrd :: Label prd -> 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.
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 :: CRule ctx prd sc ip ic sp ic' sp' -> CAspect ctx ((,) prd (CRule ctx prd sc ip ic sp ic' sp') ': ([] :: [(Prod, Type)])) 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
).
(.+:) :: (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.
(◃) :: (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 #
(.:+.) :: (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 #
(▹) :: (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`.
(.:+:) :: (Require (OpComAsp al ar) ctx, ReqR (OpComAsp al ar) ~# Rec PrdReco asp) => CAspect ctx al -> CAspect ctx ar -> CAspect ctx asp infixr 4 Source #
(⋈) :: (Require (OpComAsp al ar) ctx, ReqR (OpComAsp al ar) ~# Rec PrdReco asp) => CAspect ctx al -> CAspect ctx ar -> CAspect ctx asp infixr 4 Source #
newtype CAspect (ctx :: [ErrorMessage]) (asp :: [(Prod, Type)]) Source #
(.#) :: (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
(.*) :: Require (OpExtend (ChiReco prd) ch attrib attribs) (Text "" ': ([] :: [ErrorMessage])) => TaggedChAttr prd ch attrib -> ChAttsRec prd attribs -> ReqR (OpExtend (ChiReco prd) ch attrib attribs) infixr 2 Source #
Pretty constructors
(*.) :: Require (OpExtend AttReco att val atts) (Text "" ': ([] :: [ErrorMessage])) => 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', RequireEq prd prd' ctx, RequireEq t t' ctx, RequireEq pos (Chi ch prd (Right (T t))) ctx, m ~ Reader (Proxy ctx, Fam prd' chi par)) => Label pos -> m (ResAt pos (Att "term" t) m) Source #
sem_Lit :: SemLit a => a -> Attribution ('[] :: [(Att, Type)]) -> Attribution '['(Att "term" a, a)] Source #
knitAspect :: (Empties fc prd1, Kn fc prd1, Require (OpLookup PrdReco prd2 r) ((Text "knit" :<>: ShowTE prd2) ': ([] :: [ErrorMessage])), 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 #
traceAspect :: MapCtxAsp r ctx ((Text "aspect " :<>: e) ': ctx) => Proxy e -> CAspect ((Text "aspect " :<>: e) ': ctx) r -> CAspect ctx (ResMapCtx r ctx ((Text "aspect " :<>: e) ': ctx)) Source #
|traceAspect| adds context to an aspect.
traceRule :: Proxy e -> CRule ((Text "rule " :<>: e) ': ctx) prd sc ip ic sp ic' sp' -> CRule ctx prd sc ip ic sp ic' sp' Source #
copyAtChi :: (Require (OpUpdate (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) v2 ic) ctx, Require (OpExtend AttReco (Att att t') t' r) ctx, Require (OpLookup (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) ic) ctx, Require (OpLookup AttReco (Att att t') ip) (((((((Text "inhdef(" :<>: (((Text "Attribute " :<>: Text att) :<>: Text ":") :<>: ShowType t')) :<>: Text ", ") :<>: ((ShowTE nt :<>: Text "::Production ") :<>: Text prd)) :<>: Text ", ") :<>: ((((((ShowTE nt :<>: Text "::Production ") :<>: Text prd) :<>: Text "::Child ") :<>: Text chi) :<>: Text ":") :<>: ShowTE n)) :<>: Text ")") ': ctx), ReqR (OpLookup AttReco (Att att t') ip) ~# t', ReqR (OpExtend AttReco (Att att t') t' r) ~# Rec AttReco v2, ReqR (OpLookup (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) ic) ~# Rec AttReco r, ReqR (OpUpdate (ChiReco (Prd prd nt)) (Chi chi (Prd prd nt) (Left n :: Either NT T)) v2 ic) ~# Rec (ChiReco (Prd prd nt)) ic') => Label (Att att t') -> Label (Chi chi (Prd prd nt) (Left n :: Either NT T)) -> 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
use :: UseC att prd nts t' sp sc sp' ctx => Label (Att att t') -> Label prd -> KList nts -> (t' -> t' -> t') -> t' -> forall ip ic'. CRule ctx prd sc ip ic' sp ic' sp' Source #
Defines a rule to compute an attribute att
in the production
prd
, by applying an operator to the values of att
in each non
terminal in the list nts
.
emptyAspectC :: EmptyAspect prds polyArgs ctx => KList prds -> Proxy polyArgs -> CAspect ctx (EmptyAspectR prds polyArgs ctx) Source #
emptyAspectForProds :: EmptyAspect prds polyArgs ctx => KList prds -> CAspect ctx (EmptyAspectR prds polyArgs ctx) Source #
module Data.GenRec