Name analysis according to scope rules
Languages usually use names to identify objects. An object is created by an explicit or implicit definition and bound to a name. In a certain range of the text occurrences of that name refer to that object. The scope rules of the language determine where that binding holds. For language implementation a unique name (key) is created for each distinct object and associated to identifiers within the scope of that binding. Name analysis is completed by certain checks of relationships between identifier occurrences as required by the language, e.g. existence of a definition for each identifier use, multiple definitions (See Common Aspects of Property Modules of Association of properties to definitions, see Check for Unique Object Occurrences of Association of properties to definitions), or identifier use before its definition (see Set a Property at the First Object Occurrence of Association of properties to definitions).
This library contains a set of modules which can be used to implement the name analysis task according to a large variety of language rules. The results of these modules are used to check required relationships between identifier occurrences and to solve further subtasks of language implementation, such as type analysis or transformation. Solutions of these tasks are supported by modules of other libraries: Property Library of Association of properties to definitions, Type Analysis of Type analysis tasks, Generating Output of Tasks related to generating output.
The module support for name analysis is decomposed into subtasks of increasing complexity. They are described in subsections each. There you find three solution variants for Algol-like, C-like scope rules, and C-like scope rules computed bottom-up while the input is read:
The use of these modules is demonstrated and explained in Eli's tutorial on name analysis. (see Overview of Tutorial on Name Analysis).
It contains three complete executable specifications called
AlgLike.fw, CLike.fw, and BuCLike.fw
You can obtain a copy of these specifications by calling Eli and requesting
$elipkg/Name/Examples > .
This request creates a subdirectory