[silver:compiler:extension:convenienceaspects]
Contents of [silver:compiler:extension:convenienceaspects]
:
Defined in this grammar:
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/ConcreteSyntax.sv line 12.
A nonterminal describing what binding to use on the attribute in the generated aspects.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/ConcreteSyntax.sv line 49.
Nonterminal for the name and type of the term for which you’re constructing aspect productions for.
concrete production convenienceAspects_c
(top::AGDcl ::= 'aspect' attr::QNameAttrOccur 'on' aspectLHS::ConvAspectLHS eqKind::ConvenienceAspectEquationKind 'of' Opt_Vbar_t ml::MRuleList 'end' ';'
)
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/ConcreteSyntax.sv line 75.
Takes in the following:
- attr: The attribute you’re defining aspect productions for.
- aspectLHS: the type for your aspect productions, as well as a custom name for if you define it.
- eqKind: The binding method for defining the new attribute within the generated aspect productions.
- ml: A List of MatchRules that describe the aspects productions you’d like to make.
And returns a a single AgDcl defining all the aspect productions according to the parameters given. This is the concrete syntax for defining convenience aspects.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 10.
Parameterl
the list of patterns to modify
Return
A patternList List-Like Nonterminal instance.
From a list of Patterns, makes a PatternList with the right list-shaped productions.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 25.
Parameterl
The next patternList element to extract out patterns from.
Parameteraccum
The accumulating list of patterns.
Return
A list containing the patterns From a PatternList, makes a proper list of the patterns in them.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 43.
WARNING!
Note that the subpatterns being extracted here are only applications of productions.
Parameterpl
The patternList List-like construct we’re extracting subpatterns from.
Return
A patternList List-like construct containing only the subpatterns of the list that was provided.
Extracts out the subpatterns of productions in a patternList, but in a way that doesn’t demand attributes.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 61.
Parameterl
A list of Expr’s.
Return
A combined Exprs List-like construct made from the Expr’s in the input list.
Takes in a regular list of Expr, turns them into an instance of the Exprs production.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 75.
Parameterl
A list of match rules.
Return
A MRuleList list-like construct from the list of match rules.
Takes in a regular list of MatchRule, turns them into an instance of the MRuleList production.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 87.
Parameterl
A List-like construct MRuleList instance.
Parameteraccum
An accumulated list of MatchRule’s
Return
A regular list of MatchRule’s
Given a MRuleList element, transforms it into a regular list of MatchRules
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 102.
Parametermr
An instance of MatchRule
Return
A list of names where each name corresponds to an argument to the production subpattern.
This function goes into a production pattern (if it is one), extracts out the sub pattern for that production, and generates names for each element of that sub pattern.
e.g Given silver_matchRule {foo(bar(3,x),y) -> y+1 }
where foo
,bar
are productions, it returns [_gen1,_gen2]
(where the numbers are generated from genInt)
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 127.
Parametermr
An instance of MatchRule
Return
A wildcard matchRule with the same number of params as the production pattern.
This function goes into a production pattern (if it is one), extracts out the sub pattern for that production, and generates wildcard patterns for each param, giving back a production pattern with the appropriate number of wildcards.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 150.
Parametername
The name being defined.
Return
a concrete definition LHS element that uses the name provided.
This function takes in a name and returns a concrete definition LHS element that is the result of applying the concrete definition production to them.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 161.
ParameternewName
The name being defined.
ParameteraspectLHS
a convenience aspect LHS expression that contains the name and type of the term that our generated aspect production returns.
Parametere
The expression that uses the name we’re defining and will be surrounded by let.
Return
A Let expr that binds the name we provide to the “top” term in our aspect production with let, and surrounds the expression we gave.
This function takes in a name, aspectRHS, and expr, returning a let expression that binds the name we provide to the name of the “top” term in our aspect production. This allows one to define convenience aspects that make use of variable named wildcards, and have those names be usable in our convenience aspect definition to access other attributes of the top level term.
function extractAspectAgDclFromRuleList
(Pair<AGDcl [Message]> ::= rules::[MatchRule] aspectLHS::Decorated ConvAspectLHS aspectAttr::QNameAttrOccur eqKind::ConvenienceAspectEquationKind env::Env
)
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 198.
Parameterrules
A list of matchrules that represents a grouping of match rules with similar patterns.
ParameteraspectLHS
a convenience aspect LHS expression that contains the name and type of the term that our generated aspect production returns.
ParameteraspectAttr
The aspect attribute we’re generating productions for
ParametereqKind
The operator that assigns or binds to the attribute
Parameterenv
A Environment for looking up production types.
Return
A pair of a single AgDcl that defines the aspect production we’re generating, and a list of warnings or errors that came from generating the AgDcl.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 368.
Parameterl
first pattern we’re comparing
Parameterr
second pattern we’re comparing
Return
boolean telling us if two production patterns have the same name, otherwise compares the kind of pattern.
Compares patterns, if they’re both production patterns, compares production name otherwise compares the kind of pattern, (varname or wildcard, mostly). As a note, patterns with kinds other than varPattern,Wildcard, or prodAppPattern compare favorably with eachother even if they dont have the same kind, as this function is intended to sort patterns for convenience aspect purposes.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 392.
WARNING!
throws an error if the pattern list is nil.
ParameterpList
a PatternList construct
Return
The head pattern from the given PatternList
Extracts out the head pattern from the given PatternList.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 410.
ParametermRule
a MatchRule construct
Return
The head pattern from the given MatchRule
Extracts out the head pattern from the given matchRule.
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 428.
Parameterl
first match rule
Parameterr
second match rule
Return
Boolean telling us if the head pattern of two match rules uses the same production (or are equivalent in terms of being a wildcard or varpattern).
Compares the head pattern of two match rules, but without demanding attributes Modeled after comparison used for AbstractMatchRules
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 440.
ParametermRule
a MatchRule construct
Return
Boolean indicating whether its a wildcard match rule Given a MatchRule, tells you if its a “wildcard” match rule. varpatterns aren’t called wildcards, but they match everything just the same so they return true here.
abstract production convenienceAspects
(top::AGDcl ::= attr::QNameAttrOccur aspectLHS::Decorated ConvAspectLHS eqKind::ConvenienceAspectEquationKind ml::MRuleList
)
Contained in grammar [silver:compiler:extension:convenienceaspects]
. Defined at silver/compiler/extension/convenienceaspects/AbstractSyntax.sv line 465.
Parameterattr
The attribute for which you’d like to define aspect productions for.
ParameteraspectLHS
a convenience aspect LHS expression that contains the name and type of the term that our generated aspect production returns.
ParametereqKind
The operator that assigns or binds to the attribute
Parameterml
The Match Rules that define what aspects we’d like to generate.
Gives back a single AgDcl defining all the aspect productions according to the parameters given.
This is the abstract production for convenience aspects.
It’s generally advised if you intend to use convenience aspects to use them as concrete syntax (using the concrete production starting with aspect <attr> on ...
)