CS 536 Fall 2007, Project 5

Class ASTNode

Object
  extended by ASTNode
Direct Known Subclasses:
BlockNode, DeclNode, ExprNode, StmtNode

public abstract class ASTNode
extends Object

A node in an Abstract Syntax Tree for ada536.


Nested Class Summary
(package private) static class ASTNode.Opcode
          Operator codes.
 
Constructor Summary
ASTNode()
           
 
Method Summary
protected  void indent(PrintWriter p, int level)
          A handy utility for generating a newline followed by the indentation for the next line.
abstract  void resolveNames(SymbolTable symtab)
          Resolves all applied uses of identifiers in the tree rooted at this node.
abstract  void resolveTypes(ProcDeclNode proc)
          Fills in types for all Symbols bound to IdNodes.
 String toString()
          Produces a string representation of this node, for debugging.
abstract  void unparse(PrintWriter p, int level)
          Prints a source representation of the tree rooted at this node on output stream p.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ASTNode

public ASTNode()
Method Detail

unparse

public abstract void unparse(PrintWriter p,
                             int level)
Prints a source representation of the tree rooted at this node on output stream p.

Parameters:
p - the place to display the output.
level - the number of levels of indentation to use if the output requires more than one line.

resolveNames

public abstract void resolveNames(SymbolTable symtab)
Resolves all applied uses of identifiers in the tree rooted at this node.

Parameters:
symtab - the symbol table to be used.

resolveTypes

public abstract void resolveTypes(ProcDeclNode proc)
Fills in types for all Symbols bound to IdNodes. Prints error messages as necessary.

Parameters:
proc - the smallest enclosing procedure or function declaration.

toString

public String toString()
Produces a string representation of this node, for debugging.

Overrides:
toString in class Object
Returns:
a String version of this node.

indent

protected void indent(PrintWriter p,
                      int level)
A handy utility for generating a newline followed by the indentation for the next line.

Parameters:
p - the place to display the output.
level - the number of levels to indent.

CS 536 Fall 2007, Project 5