junc.ast
Class CompilationUnitNode

java.lang.Object
  |
  +--antlr.BaseAST
        |
        +--antlr.CommonAST
              |
              +--junc.ast.JUnCASTNode
                    |
                    +--junc.ast.CompilationUnitNode
All Implemented Interfaces:
antlr.collections.AST, java.io.Serializable

public class CompilationUnitNode
extends JUnCASTNode

Represents a Compilation Unit (one java source file).

Version:
1.0
Author:
Diwaker Gupta
See Also:
Serialized Form

Field Summary
 java.util.Vector imports
          A Symbol vector with all the import declarations defined in this module.
 junc.symtab.Symbol packageName
          The name of the package to which the compilation unit belongs to.
 java.util.Vector types
          A vector of type declarations (classes or interfaces) defined in this module.
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
CompilationUnitNode()
          Creates a new CompilationUnitNode instance.
 
Method Summary
 void addImport(junc.symtab.Symbol imp)
          Add an import symbol.
 void translate()
          Generates byte code for this unit.
 junc.types.JUnCBaseType typeCheck(junc.symtab.SymbolTable symbolTable)
          Checks type for each class/interface definition in this unit.
 
Methods inherited from class junc.ast.JUnCASTNode
getColumnNumber, getLineNumber, setColumnNumber, setLineNumber
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, initialize, initialize, setText, setType
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toString, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

packageName

public junc.symtab.Symbol packageName
The name of the package to which the compilation unit belongs to.


imports

public java.util.Vector imports
A Symbol vector with all the import declarations defined in this module.


types

public java.util.Vector types
A vector of type declarations (classes or interfaces) defined in this module.

Constructor Detail

CompilationUnitNode

public CompilationUnitNode()
Creates a new CompilationUnitNode instance.

Method Detail

typeCheck

public junc.types.JUnCBaseType typeCheck(junc.symtab.SymbolTable symbolTable)
                                  throws TypeCheckError
Checks type for each class/interface definition in this unit.

Specified by:
typeCheck in class JUnCASTNode
Parameters:
symbolTable - a SymbolTable value
Returns:
a JUnCBaseType value
Throws:
TypeCheckError - if an error occurs

translate

public void translate()
Generates byte code for this unit.


addImport

public void addImport(junc.symtab.Symbol imp)
Add an import symbol.

Parameters:
imp - a Symbol value