comp
Class WhileNode
java.lang.Object
|
+--comp.Node
|
+--comp.WhileNode
- class WhileNode
- extends Node
A while loop. Contains a test expression and a body.
Method Summary |
void |
addDefs(Scope s)
Add any variable definitions made by this node to the given scope. |
void |
asHTML(java.io.PrintStream out)
Process the body. |
java.lang.String |
codeGen(Scope scope,
RegBank bank)
Generate code for the test. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
test
ExprNode test
body
BlockNode body
WhileNode
public WhileNode(ExprNode test,
BlockNode body)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
codeGen
public java.lang.String codeGen(Scope scope,
RegBank bank)
- Generate code for the test. If it is false, jump to the bottom,
otherwise fall through into the body. The body is rooted with
a jump back up to the top.
- Specified by:
codeGen
in class Node
addDefs
public void addDefs(Scope s)
- Description copied from class:
Node
- Add any variable definitions made by this node to the given scope.
- Overrides:
addDefs
in class Node
asHTML
public void asHTML(java.io.PrintStream out)
- Process the body.
- Specified by:
asHTML
in class Node