All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class espresso.util.SymbolTable

java.lang.Object
   |
   +----java.util.Dictionary
           |
           +----java.util.Hashtable
                   |
                   +----espresso.util.SymbolTable

public class SymbolTable
extends Hashtable

Variable Index

 o NUMBER_METHODS

Constructor Index

 o SymbolTable()
 o SymbolTable(int, float)

Method Index

 o addField(Symbol, FieldDeclarationNode)
Adds a field name to the symbol table.
 o addFormal(Symbol, FormalParameterNode)
Adds a formal param to the symbol table.
 o addLabel(Symbol, LabeledStatementNode)
Adds a statement label to the symbol table.
 o addLocal(Symbol, LocalVarDeclarationNode)
Adds a local var to the symbol table.
 o addMethod(Symbol, MethodDeclarationNode)
Adds a method name to the symbol table.
 o addPackage(Symbol, CompilationUnitNode)
Adds a package declaration to the symbol table.
 o addPrimop(Symbol, MethodType)
Adds a primop name to the symbol table.
 o addType(Symbol, TypeDeclarationNode)
Adds a class or an interface name to the symbol table.
 o lookupField(Symbol)
Looks up a field declaration in the symbol table.
 o lookupFormal(Symbol)
Looks up a formal parameter in the symbol table.
 o lookupLabel(Symbol)
Looks up a statement label in the symbol table.
 o lookupLocal(Symbol)
Looks up a local var in the symbol table.
 o lookupMethod(Symbol)
Looks up a method declaration in the symbol table.
 o lookupPackage(Symbol)
Looks up a package declaration in the symbol table.
 o lookupPrimop(Symbol)
Looks up a primop in the symbol table.
 o lookupType(Symbol)
Looks up a class or interface declaration in the symbol table.

Variables

 o NUMBER_METHODS
 static final int NUMBER_METHODS

Constructors

 o SymbolTable
 public SymbolTable()
 o SymbolTable
 public SymbolTable(int size,
                    float factor)

Methods

 o addPackage
 public CompilationUnitNode addPackage(Symbol name,
                                       CompilationUnitNode node)
Adds a package declaration to the symbol table. The name should be fully qualified.

 o lookupPackage
 public CompilationUnitNode lookupPackage(Symbol name)
Looks up a package declaration in the symbol table. If the name is not present or does not correspond to a package null is returned.

 o addType
 public TypeDeclarationNode addType(Symbol name,
                                    TypeDeclarationNode node)
Adds a class or an interface name to the symbol table. Names should be fully qualified.

 o lookupType
 public TypeDeclarationNode lookupType(Symbol name)
Looks up a class or interface declaration in the symbol table. If the name is not present or does not correspond to a class or an interface then null is returned.

 o addField
 public FieldDeclarationNode addField(Symbol name,
                                      FieldDeclarationNode node)
Adds a field name to the symbol table. Names should be fully qualified. A forward declaration may be resolved.

 o lookupField
 public FieldDeclarationNode lookupField(Symbol name)
Looks up a field declaration in the symbol table. If the name is not present or does not correspond to a field, null is returned.

 o addMethod
 public Vector addMethod(Symbol name,
                         MethodDeclarationNode node)
Adds a method name to the symbol table. Names should be fully qualified. A key is built by appending "()" to the name. A vector is kept for each name (method overloading).

 o lookupMethod
 public Vector lookupMethod(Symbol name)
Looks up a method declaration in the symbol table. A key is built by appending "()" to the name. If the name is not present or does not correspond to a method, null is returned.

 o addFormal
 public FormalParameterNode addFormal(Symbol name,
                                      FormalParameterNode node)
Adds a formal param to the symbol table. A name must be qualified with the method (that also includes package and class) and a unique index identifying outermost scope.

 o lookupFormal
 public FormalParameterNode lookupFormal(Symbol name)
Looks up a formal parameter in the symbol table. If the name is not present or does not correspond to a field, null is returned.

 o addLocal
 public LocalVarDeclarationNode addLocal(Symbol name,
                                         LocalVarDeclarationNode node)
Adds a local var to the symbol table. A name must be qualified with the method (that also includes package and class) and a unique index identifying the scope.

 o lookupLocal
 public LocalVarDeclarationNode lookupLocal(Symbol name)
Looks up a local var in the symbol table. If the name is not present or does not correspond to a field, null is returned.

 o addPrimop
 public Vector addPrimop(Symbol name,
                         MethodType mtype)
Adds a primop name to the symbol table. A vector is kept for each name (overloading).

 o lookupPrimop
 public Vector lookupPrimop(Symbol name)
Looks up a primop in the symbol table. If the name is not present or does not correspond to a primop, null is returned.

 o addLabel
 public LabeledStatementNode addLabel(Symbol name,
                                      LabeledStatementNode node)
Adds a statement label to the symbol table. Appends a ":" to avoid name clashes.

 o lookupLabel
 public LabeledStatementNode lookupLabel(Symbol name)
Looks up a statement label in the symbol table. Appends ":" to the name before searching.


All Packages  Class Hierarchy  This Package  Previous  Next  Index