|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectgeneralHelpers.TreeNode
treeNodes.Program
public class Program
Defines AST constructor 'program'.
See TreeNode for full documentation.
Field Summary | |
---|---|
protected ListNode<Class_> |
classes
|
Fields inherited from class generalHelpers.TreeNode |
---|
lineNumber |
Constructor Summary | |
---|---|
Program(int lineNumber,
ListNode<Class_> a1)
Creates "program" AST node. |
Method Summary | |
---|---|
void |
cgen(java.io.PrintWriter s)
This is the entry method for the code generation. |
TreeNode |
copy()
Creates a copy of this node. |
void |
dump(java.io.Writer out,
int n)
Pretty-prints this node to this output stream. |
void |
dumpWithTypes(java.io.Writer out,
int n)
|
ListNode<Class_> |
getClasses()
|
void |
semant()
This method is the entry point to the semantic checker. |
Methods inherited from class generalHelpers.TreeNode |
---|
copyAbstractSymbol, copyBoolean, dumpAbstractSymbol, dumpBoolean, dumpLine, getLineNumber, set |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ListNode<Class_> classes
Constructor Detail |
---|
public Program(int lineNumber, ListNode<Class_> a1)
lineNumber
- the line in the source file from which this node came.a0
- initial value for classesMethod Detail |
---|
public ListNode<Class_> getClasses()
public TreeNode copy()
TreeNode
copy
in class TreeNode
public void dump(java.io.Writer out, int n) throws java.io.IOException
TreeNode
dump
in class TreeNode
out
- the output streamn
- the number of spaces to indent the output
java.io.IOException
public void dumpWithTypes(java.io.Writer out, int n) throws java.io.IOException
java.io.IOException
public void semant() throws SemanticError
Your checker should do the following two things:
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.
SemanticError
- to signal error in semantic checkingpublic void cgen(java.io.PrintWriter s)
s
- -- writer to write the generated code to
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |