ponderToolkit.compiler.semantics
Class Table

java.lang.Object
  |
  +--ponderToolkit.compiler.semantics.Table

public class Table
extends java.lang.Object

Function: Models an Environment Table. The Table class is similar to java.util.Dictionary, except that each key must be a Symbol. Table is filled in with Binder objects.


Constructor Summary
Table()
          Constructor when the environment has no parent
Table(Table newParentEnv)
          Constructor for a new environment with a parent
Table(Table newParentEnv, Compiler newCompiler)
          Constructor for a new environment with a parent and a reference to the Ponder Compiler for reporting messages
 
Method Summary
 Entry get(Symbol key)
          Gets the Entry entry object associated with the specified symbol in the Table.
 Binder getBinder(Symbol key)
          Returns the binder for the given key.
 java.lang.Class getLibraryClass()
          BLH Addition Returns the class for this library.
 java.lang.Class getLibraryObjectClass()
          BLH Addition Returns the class modeling this library's objects.
 Table getParent()
          Returns the parent environment.
 java.util.Enumeration keys()
          Returns an enumeration of the Table's symbols.
 void print()
          Prints the Table (for testing purposes)
 Binder put(Symbol key, Entry entry, Table env)
          Puts the specified entry into the Table, bound to the specified Symbol.
 Binder put(Symbol key, Entry entry, Table env, TokenPosition pos)
          Puts the specified entry into the Table, bound to the specified Symbol.
 void setCompiler(Compiler newCompiler)
          Sets the Ponder Compiler for reporting messages
 void setLibraryClass(java.lang.Class cls)
          BLH Addition Set the class for this library.
 void setLibraryObjectClass(java.lang.Class cls)
          BLH Addition Set the class modeling this library's objects.
 void setParent(Table newParentEnv)
          Set the parent environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Table

public Table()
Constructor when the environment has no parent

Table

public Table(Table newParentEnv)
Constructor for a new environment with a parent

Table

public Table(Table newParentEnv,
             Compiler newCompiler)
Constructor for a new environment with a parent and a reference to the Ponder Compiler for reporting messages
Method Detail

setCompiler

public void setCompiler(Compiler newCompiler)
Sets the Ponder Compiler for reporting messages

get

public Entry get(Symbol key)
Gets the Entry entry object associated with the specified symbol in the Table.

put

public Binder put(Symbol key,
                  Entry entry,
                  Table env)
Puts the specified entry into the Table, bound to the specified Symbol. It returns the newly created Binder object

put

public Binder put(Symbol key,
                  Entry entry,
                  Table env,
                  TokenPosition pos)
Puts the specified entry into the Table, bound to the specified Symbol. It returns the newly created Binder object. The TokenPosition of the symbol in the specification is also passed along to be used in case of a "duplicate definition" error reporting

getBinder

public Binder getBinder(Symbol key)
Returns the binder for the given key.

setParent

public void setParent(Table newParentEnv)
Set the parent environment.

getParent

public Table getParent()
Returns the parent environment.

keys

public java.util.Enumeration keys()
Returns an enumeration of the Table's symbols.

setLibraryClass

public void setLibraryClass(java.lang.Class cls)
BLH Addition Set the class for this library.

getLibraryClass

public java.lang.Class getLibraryClass()
BLH Addition Returns the class for this library.

setLibraryObjectClass

public void setLibraryObjectClass(java.lang.Class cls)
BLH Addition Set the class modeling this library's objects.

getLibraryObjectClass

public java.lang.Class getLibraryObjectClass()
BLH Addition Returns the class modeling this library's objects.

print

public void print()
Prints the Table (for testing purposes)