Class BoolConst

java.lang.Object
  extended byBoolConst

class BoolConst
extends java.lang.Object

This clas encapsulates all aspects of code generation for boolean constatns. String constants and Int constants are handled by StringTable and IntTable respectively, but since there are only two boolean constants, we handle them here.


Field Summary
(package private) static BoolConst falsebool
           
(package private) static BoolConst truebool
           
private  boolean val
           
 
Constructor Summary
(package private) BoolConst(boolean val)
          Creates a new boolean constant.
(package private) BoolConst(java.lang.Boolean val)
          Creates a new boolean constant.
 
Method Summary
 void codeDef(int boolclasstag, java.io.PrintStream s)
          Generates code for the boolean constant definition.
 void codeRef(java.io.PrintStream s)
          Emits a reference to this boolean constant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

val

private boolean val

truebool

static final BoolConst truebool

falsebool

static final BoolConst falsebool
Constructor Detail

BoolConst

BoolConst(boolean val)
Creates a new boolean constant.

Parameters:
val - the value

BoolConst

BoolConst(java.lang.Boolean val)
Creates a new boolean constant.

Parameters:
val - the value
Method Detail

codeRef

public void codeRef(java.io.PrintStream s)
Emits a reference to this boolean constant.

Parameters:
s - the output stream

codeDef

public void codeDef(int boolclasstag,
                    java.io.PrintStream s)
Generates code for the boolean constant definition. This method is incomplete; you get to finish it up in programming assignment 5.

Parameters:
boolclasstag - the class tag for string object
s - the output stream