comp
Class WhileNode

java.lang.Object
  |
  +--comp.Node
        |
        +--comp.WhileNode

class WhileNode
extends Node

A while loop. Contains a test expression and a body.


Field Summary
(package private)  BlockNode body
           
(package private)  ExprNode test
           
 
Fields inherited from class comp.Node
asm, globalScope, labelCount, strings
 
Constructor Summary
WhileNode(ExprNode test, BlockNode 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 comp.Node
addString, getLabel, lvalue, reset, rvalue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

test

ExprNode test

body

BlockNode body
Constructor Detail

WhileNode

public WhileNode(ExprNode test,
                 BlockNode body)
Method Detail

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