General Information
Tutorials
Reference Manuals
Libraries
Translation Tasks
Tools
Administration
|
Tutorial on Name AnalysisBasic Scope Rules
In many cases of name analysis the language distinguishes between
defining occurrences of identifiers in declaration and applied
occurrences in expressions (an example with only one kind of identifier
occurrence is shown below).
Hence, we extend our kernel grammar by
Furthermore we introduce nested CoreScope.con[5]== Declaration: 'val' ValDecls ';'. ValDecls: ValDecl // ','. ValDecl: DefIdent '=' Expression. Expression: Block. Operand: UseIdent. DefIdent: Ident. UseIdent: Ident. This macro is attached to a product file.
The basic task of name analysis is consistent renaming.
For each identifier occurrence a The scope rules of a language determine how identifier occurrences are bound to program objects. 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 computational roles CoreScope.lido[7]== SYMBOL Block INHERITS RangeScope END; SYMBOL DefIdent INHERITS IdDefScope, IdentOcc END; SYMBOL UseIdent INHERITS IdUseEnv, IdentOcc END; This macro is attached to a product file.
As a result attributes
|