Class CgenClassTable

java.lang.Object
  extended bySymbolTable
      extended byCgenClassTable

class CgenClassTable
extends SymbolTable

This class is used for representing the inheritance tree during code generation. You will need to fill in some of its methods and potentially extend it in other useful ways.


Constructor Summary
CgenClassTable(Classes cls, java.io.PrintStream str)
          Constructs a new class table and invokes the code generator
 
Method Summary
 void addId(AbstractSymbol id, java.lang.Object info)
          Adds a new entry to the symbol table.
 void code()
          This method is the meat of the code generator.
 SymbolTable deepCopy()
          Returns a clone of the symbol table (ECL).
 void enterScope()
          Enters a new scope.
 void exitScope()
          Exits the most recently entered scope.
 java.lang.Object lookup(AbstractSymbol sym)
          Looks up an item through all scopes of the symbol table.
 java.lang.Object probe(AbstractSymbol sym)
          Probes the symbol table.
 CgenNode root()
          Gets the root of the inheritance tree
 java.lang.String toString()
          Gets the string representation of the symbol table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CgenClassTable

public CgenClassTable(Classes cls,
                      java.io.PrintStream str)
Constructs a new class table and invokes the code generator

Method Detail

code

public void code()
This method is the meat of the code generator. It is to be filled in programming assignment 5


root

public CgenNode root()
Gets the root of the inheritance tree


enterScope

public void enterScope()
Enters a new scope. A scope must be entered before anything can be added to the table.


exitScope

public void exitScope()
Exits the most recently entered scope.


addId

public void addId(AbstractSymbol id,
                  java.lang.Object info)
Adds a new entry to the symbol table.

Parameters:
id - the symbol
info - the data asosciated with id

lookup

public java.lang.Object lookup(AbstractSymbol sym)
Looks up an item through all scopes of the symbol table. If found it returns the associated information field, if not it returns null.

Parameters:
sym - the symbol
Returns:
the info associated with sym, or null if not found

probe

public java.lang.Object probe(AbstractSymbol sym)
Probes the symbol table. Check the top scope (only) for the symbol sym. If found, return the information field. If not return null.

Parameters:
sym - the symbol
Returns:
the info associated with sym, or null if not found

deepCopy

public SymbolTable deepCopy()
Returns a clone of the symbol table (ECL).


toString

public java.lang.String toString()
Gets the string representation of the symbol table.

Returns:
the string rep