Class VariableEntry

java.lang.Object
  extended bySymbolTableEntry
      extended byVariableEntry

public class VariableEntry
extends SymbolTableEntry

VariableEntry extends SymbolTableEntry by adding data fields to support variables and parameters. It has a boolean field indicating if this is a reference-type symbol. Reference-type symbols are definable in programming languages with explicitly declared pointer types and/or call-by-reference parameters.

VariableEntry also has an integer memory location field. This can be either an absolute address, or a relative offset, e.g., in a stack frame.


Field Summary
 boolean isRef
          True if this is a reference variable or parameter.
 int level
          The lexical nesting level of this variable.
 int memoryLocation
          Memory location
 
Fields inherited from class SymbolTableEntry
name, type
 
Constructor Summary
VariableEntry()
          Construct this with null data fields.
VariableEntry(java.lang.String name, TypeNode type, boolean isRef, int memoryLocation, int level)
          Construct this with the given data field values.
 
Method Summary
 java.lang.String toString(int level)
          Return the string rep of this, which consists of the return value of super.toString, plus the values of this.isRef and this.memoryLocation.
 
Methods inherited from class SymbolTableEntry
doToString, indentString, toString, toStringDeep, toStringDeep
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isRef

public boolean isRef
True if this is a reference variable or parameter.


memoryLocation

public int memoryLocation
Memory location


level

public int level
The lexical nesting level of this variable. This is a convenience for computing the runtime address of the variable. If the level = 0, then the address is relative to the top of the static pool. If the level is > 0, then the address is relative to the current top of the stack.

Constructor Detail

VariableEntry

public VariableEntry()
Construct this with null data fields.


VariableEntry

public VariableEntry(java.lang.String name,
                     TypeNode type,
                     boolean isRef,
                     int memoryLocation,
                     int level)
Construct this with the given data field values.

Method Detail

toString

public java.lang.String toString(int level)
Return the string rep of this, which consists of the return value of super.toString, plus the values of this.isRef and this.memoryLocation.

Overrides:
toString in class SymbolTableEntry