CS 536 Fall 2007, Project 5

Class Symbol

Object
  extended by Symbol

public class Symbol
extends Object

Information about a symbol (an identifier).


Field Summary
 boolean inParameter
          True for formal parameters of mode IN or NONE.
 int offset
          The offset of this symbol from the frame pointer.
 
Constructor Summary
Symbol(String name)
          Creates a new Symbol.
 
Method Summary
 String getName()
          Returns the name of this symbol.
 Type getType()
          Returns the type of this symbol.
 void setType(Type type)
          Sets the type of this symbol.
 String toString()
          Convert this Symbol to a String, for debugging.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

offset

public int offset
The offset of this symbol from the frame pointer. The value is normally less than or equal to zero. By convention, an offset of 1 indicates a global variable (declared in the main procedure). This field is not used if type.kind == PROCEDURE.


inParameter

public boolean inParameter
True for formal parameters of mode IN or NONE. False for OUT or INOUT parameters or ordinary variables.

Constructor Detail

Symbol

public Symbol(String name)
Creates a new Symbol.

Parameters:
name - the name of the Symbol.
Method Detail

setType

public void setType(Type type)
Sets the type of this symbol.

Parameters:
type - the new type.
See Also:
getType()

getName

public String getName()
Returns the name of this symbol.

Returns:
the name of this symbol.

getType

public Type getType()
Returns the type of this symbol.

Returns:
the type of this symbol.
See Also:
setType(Type)

toString

public String toString()
Convert this Symbol to a String, for debugging.

Overrides:
toString in class Object

CS 536 Fall 2007, Project 5