General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
Tutorial on Name AnalysisScopes being Properties of ObjectsCertain language constructs require that a set of bindings, i.e. a scope is associated as a property of an object. We demonstrate this facility by introducing modules to our language: ScopeProp.con[21]== Declaration: 'module' DefIdent ModBlock ';'. ModBlock: Compound. Operand: ModUseIdent '::' QualIdent. ModUseIdent: Ident. QualIdent: Ident. This macro is attached to a product file.
Any object A library module (see Scopes Being Properties of Objects of Specification Module Library: Name Analysis) provides computational roles for scopes being associated with object keys: ScopeProp.specs[22]== $/Name/ScopeProp.gnrc:inst This macro is attached to a product file.
The scope of the module body, with its local definitions,
is associated as a property with the key representing the module.
The role ScopePropDef.lido[23]== SYMBOL ModBlock INHERITS ExportRange END; RULE: Declaration ::= 'module' DefIdent ModBlock ';' COMPUTE ModBlock.ScopeKey = DefIdent.Key; END; This macro is attached to a product file.
In binding a qualified identifier occurrence,
We assume that In addition, the roles used for applied identifier occurrences are associated. ScopePropUse.lido[24]== RULE: Expression ::= ModUseIdent '::' QualIdent COMPUTE QualIdent.ScopeKey = ModUseIdent.Key; IF (AND (NE (QualIdent.ScopeKey, NoKey), EQ (QualIdent.Scope, NoEnv)), message (FATAL, CatStrInd ("module or class identifier required: ", ModUseIdent.Sym), 0, COORDREF)); END; SYMBOL ModUseIdent INHERITS IdUseEnv, ChkIdUse, IdentOcc END; SYMBOL QualIdent INHERITS QualIdUse, ChkQualIdUse, IdentOcc END; This macro is attached to a product file.
|