General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
Tutorial on Name AnalysisInsertion of Scopes into the Environment HierarchyWe now demonstrate how scopes obtained from object properties are inserted into the environment hierarchy given by the syntactically nested ranges. For this purpose we extend our module example.
We introduce a ScopeInsert.con[25]== Statement: 'with' WithClause 'do' WithBody. WithClause: ModUseIdent. WithBody: Statement. This macro is attached to a product file.
The We use another library module (see Inheritance of Scopes of Specification Module Library: Name Analysis) to support such an embedding of environments: ScopeInsert.specs[26]== $/Name/AlgInh.gnrc:inst This macro is attached to a product file.
The facility of inserting an environment obtained from a scope
property of an object is provided by
the module role ScopeInsert.lido[27]== SYMBOL WithBody INHERITS InhRange END; RULE: Statement ::= 'with' WithClause 'do' WithBody COMPUTE WithClause.InnerScope = WithBody.Env; WithBody.GotInh = WithClause.InheritOk; END; SYMBOL WithClause INHERITS InheritScope, ChkInherit END; RULE: WithClause ::= ModUseIdent COMPUTE WithClause.ScopeKey = ModUseIdent.Key; END; This macro is attached to a product file.
|