![]() |
![]() |
![]() |
General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
![]() |
![]() |
Tutorial on Type AnalysisBasic Scope Rules
The basic task of name analysis is consistent renaming.
For each identifier occurrence a For the kernel language we distinguish the following identifier occurrences: Scope.con[5]== DefIdent: Ident. UseIdent: Ident. TypeUseIdent: Ident. This macro is attached to a product file. The scope rules of a language determine how identifier occurrences are bound to program objects. We specify Algol-like scope rules for our language. The basic Algol-like scope rule reads:
A definition of an identifier Hence, a definition in an outer range is hidden by a definition of the same identifier in an inner range for the whole inner range. Identifiers may be applied before they are defined. We instantiate a library module that provides computations according to this scope rule: CoreScope.specs[6]== $/Name/AlgScope.gnrc:inst This macro is attached to a product file.
The use of that module requires that every identifier occurrence
has the attribute
The computational roles CoreScope.lido[7]== TERM Ident: int; ATTR Sym: int; CLASS SYMBOL IdentOcc COMPUTE SYNT.Sym = TERM; END; SYMBOL Block INHERITS RangeScope END; SYMBOL DefIdent INHERITS IdDefScope, IdentOcc END; SYMBOL UseIdent INHERITS IdUseEnv, IdentOcc END; SYMBOL TypeUseIdent INHERITS IdUseEnv, IdentOcc END; This macro is attached to a product file.
|