fmrisc.AST
Class Reference

java.lang.Object
  extended byfmrisc.AST.ASTBase
      extended byfmrisc.AST.Identifier
          extended byfmrisc.AST.Reference
All Implemented Interfaces:
AST, Expression, Type

public final class Reference
extends Identifier
implements Type, Expression

Handling of identifiers used in declarations


Constructor Summary
Reference(java.lang.String name)
          construct reference from name (entry is set to null)
Reference(java.lang.String name, SymbolTableEntry entry)
          construct reference from name and symbol table entry
 
Method Summary
 SymbolTableEntry getEntry()
          returns symbol table entry associated to reference
 java.lang.String getName()
          returns name of identifier overrides Identifier method such that the name stored in the symbol table entry is returned (if it exists)
 Expression instantiate()
          return copy of AST with value references instantiated by the substitutions set in the corresponding declaration identifiers
 Type instantiateType()
          return copy of AST with value references instantiated by the substitutions set in the corresponding declaration identifiers
 void print(java.io.PrintWriter out)
          Prints text representation on out (without new line termination).
 void printCore(java.io.PrintWriter out)
          Prints text representation on out (without new line termination).
 void setEntry(SymbolTableEntry entry)
          sets symbol table entry associated to reference
 
Methods inherited from class fmrisc.AST.Identifier
printPriority, setName
 
Methods inherited from class fmrisc.AST.ASTBase
printParens, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fmrisc.AST.AST
printParens, toString
 
Methods inherited from interface fmrisc.AST.Expression
printPriority
 

Constructor Detail

Reference

public Reference(java.lang.String name)
construct reference from name (entry is set to null)

Parameters:
name - the text representation of the reference

Reference

public Reference(java.lang.String name,
                 SymbolTableEntry entry)
construct reference from name and symbol table entry

Parameters:
name - the text representation of the reference
entry - the symbol table entry associated to the reference
Method Detail

getName

public java.lang.String getName()
returns name of identifier overrides Identifier method such that the name stored in the symbol table entry is returned (if it exists)

Overrides:
getName in class Identifier
Returns:
the identifier name

getEntry

public SymbolTableEntry getEntry()
returns symbol table entry associated to reference

Returns:
the symbol table entry

setEntry

public void setEntry(SymbolTableEntry entry)
sets symbol table entry associated to reference

Returns:
the symbol table entry

instantiate

public Expression instantiate()
return copy of AST with value references instantiated by the substitutions set in the corresponding declaration identifiers

Specified by:
instantiate in interface Expression
Returns:
the instantiated copy

instantiateType

public Type instantiateType()
return copy of AST with value references instantiated by the substitutions set in the corresponding declaration identifiers

Specified by:
instantiateType in interface Type
Returns:
the instantiated copy

printCore

public void printCore(java.io.PrintWriter out)
Prints text representation on out (without new line termination).

Specified by:
printCore in interface AST
Overrides:
printCore in class Identifier
Parameters:
out - the stream on which the text is written

print

public void print(java.io.PrintWriter out)
Prints text representation on out (without new line termination). Overrides ASTBase.print such that parentheses are never printed around the number.

Specified by:
print in interface AST
Overrides:
print in class Identifier
Parameters:
out - the stream on which the text is written