next up previous
Next: Packages Up: An Analyzer for Java Previous: Statements


Name Analysis

Names are used to refer to entities declared in a Java program. A declared entity is a package, class type, interface type, member (field or method) of a reference type, parameter (to a method, constructor, or exception handler), or local variable.

Every name introduced by a declaration has a scope, which is the part of the Java program text within which the declared entity can be referred to by a simple name.

This specification implements the scope rules of Java. It uses a number of Eli modules specifying computational roles that are useful in name analysis.

Name.specs[1]:
Instantiate required modules[3]
This macro is attached to a product file.

A precondition for using any of Eli's name analysis modules is that every identifier occurrence have a Sym attribute:

Name.lido[2]:
CLASS SYMBOL IdentOcc COMPUTE SYNT.Sym=TERM; END;

Packages[4]
Scopes[11]
Applied occurrences of names[21]
Labeled Statements[35]
This macro is attached to a product file.

The same identifier can be used in a specific context to denote a package, a type, a method, or a field. Although a local variable name can hide a field name, local variables and fields obey different scope rules. Thus each of the five kinds of entities has its own name space, implemented by an instantiation of an Eli name analysis module. All of the computational roles of a specific module instance are qualified by the instance name.

Instantiate required modules[3]:

$/Name/AlgScope.gnrc +instance=Typ +referto=Typ :inst
$/Name/AlgInh.gnrc   +instance=Typ +referto=Typ :inst
$/Name/ScopeProp.gnrc+instance=Typ +referto=Typ :inst

$/Name/AlgScope.gnrc +instance=Fld +referto=Fld :inst
$/Name/AlgInh.gnrc   +instance=Fld +referto=Fld :inst
$/Name/ScopeProp.gnrc+instance=Fld +referto=Fld :inst

$/Name/AlgScope.gnrc +instance=Mth +referto=Mth :inst
$/Name/AlgInh.gnrc   +instance=Mth +referto=Mth :inst
$/Name/ScopeProp.gnrc+instance=Mth +referto=Mth :inst

$/Name/CScope.gnrc   +instance=Var +referto=Var :inst
This macro is defined in definitions 3, 6, 7, 27, 30, and 36.
This macro is invoked in definition 1.



Subsections
next up previous
Next: Packages Up: An Analyzer for Java Previous: Statements
2008-09-11