Class programc

java.lang.Object
  extended by TreeNode
      extended by Program
          extended by programc

 class programc
extends Program

Defines AST constructor 'programc'.

See TreeNode for full documentation.


Field Summary
protected  Classes classes
           
 
Fields inherited from class TreeNode
lineNumber
 
Constructor Summary
programc(int lineNumber, Classes a1)
          Creates "programc" AST node.
 
Method Summary
 void cgen(java.io.PrintStream s)
          This method is the entry point to the code generator.
 TreeNode copy()
          Creates a copy of this node.
 void dump_with_types(java.io.PrintStream out, int n)
           
 void dump(java.io.PrintStream out, int n)
          Pretty-prints this node to this output stream.
 void semant()
          This method is the entry point to the semantic checker.
 
Methods inherited from class TreeNode
copy_AbstractSymbol, copy_Boolean, dump_AbstractSymbol, dump_Boolean, dump_line, getLineNumber, set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classes

protected Classes classes
Constructor Detail

programc

public programc(int lineNumber,
                Classes a1)
Creates "programc" AST node.

Parameters:
lineNumber - the line in the source file from which this node came.
a1 - initial value for classes
Method Detail

copy

public TreeNode copy()
Description copied from class: TreeNode
Creates a copy of this node.

Specified by:
copy in class TreeNode
Returns:
a copy of this node

dump

public void dump(java.io.PrintStream out,
                 int n)
Description copied from class: TreeNode
Pretty-prints this node to this output stream.

Specified by:
dump in class TreeNode
Parameters:
out - the output stream
n - the number of spaces to indent the output

dump_with_types

public void dump_with_types(java.io.PrintStream out,
                            int n)
Specified by:
dump_with_types in class Program

semant

public void semant()
This method is the entry point to the semantic checker. You will need to complete it in programming assignment 4.

Your checker should do the following two things:

  1. Check that the program is semantically correct
  2. Decorate the abstract syntax tree with type information by setting the type field in each Expression node. (see tree.h)

You are free to first do (1) and make sure you catch all semantic errors. Part (2) can be done in a second stage when you want to test the complete compiler.

Specified by:
semant in class Program

cgen

public void cgen(java.io.PrintStream s)
This method is the entry point to the code generator. All of the work of the code generator takes place within CgenClassTable constructor.

Specified by:
cgen in class Program
Parameters:
s - the output stream
See Also:
CgenClassTable