at.dms.kjc
Class Main

java.lang.Object
  extended by at.dms.compiler.Compiler
      extended by at.dms.kjc.Main
All Implemented Interfaces:
DeepCloneable
Direct Known Subclasses:
TestK2S

public class Main
extends Compiler

This class implements the entry point of the Java compiler


Field Summary
protected  boolean errorFound
           
protected  Vector infiles
           
protected  KjcOptions options
           
 
Constructor Summary
Main()
           
 
Method Summary
protected  void acceptMultiProc(JCompilationUnit[] tree)
           
protected  void checkBody(JCompilationUnit cunit)
          check that body of a given compilation unit is correct side effect: increment error number
protected  void checkBodyMultiProc(JCompilationUnit[] tree)
           
protected  void checkInitializers(JCompilationUnit cunit)
          check that interface of a given compilation unit is correct side effect: increment error number
protected  void checkInterface(JCompilationUnit cunit)
          check that interface of a given compilation unit is correct side effect: increment error number
static boolean compile(String[] args)
          Second entry point
protected  boolean filterWarning(CWarning warning)
           
 void genCode()
          Generates the code from an array of compilation unit and a destination
protected  void genCodeMultiProc(CSourceClass[] tree, BytecodeOptimizer optimizer, String destination)
           
protected  void generateJavaCode(JCompilationUnit cunit)
          generate the source code of parsed compilation unit
 CSourceClass[] getClasses()
          Returns the classes to generate
protected  WarningFilter getFilter()
           
 KjcPrettyPrinter getPrettyPrinter(String fileName)
          ...
protected  void initialize()
          Initialize the compiler (read classpath, check classes.zip)
static void main(String[] args)
          Entry point
 boolean parseArguments(String[] args)
          Parse the argument list
 boolean parseComments()
          Returns true iff comments should be parsed (false if to be skipped)
protected  JCompilationUnit parseFile(File file)
          parse the givven file and return a compilation unit side effect: increment error number
protected  void parseMultiProc(JCompilationUnit[] tree)
          Parse each file in multi thread
 void reportTrouble(PositionedError trouble)
          Reports a trouble (error or warning).
 void reportTrouble(UnpositionedError trouble)
          Reports a trouble.
 boolean run(String[] args)
          Runs a compilation session
 boolean verboseMode()
          returns true iff compilation in verbose mode is requested.
 
Methods inherited from class at.dms.compiler.Compiler
checkDestination, deepClone, deepCloneInto, getTimestamp, inform, inform, inform, inform, inform, inform, inform, run, setWorkingDirectory, verifyFiles, verifyFiles
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

infiles

protected Vector infiles

errorFound

protected boolean errorFound

options

protected KjcOptions options
Constructor Detail

Main

public Main()
Method Detail

main

public static void main(String[] args)
Entry point

Parameters:
args - the command line arguments

compile

public static boolean compile(String[] args)
Second entry point


run

public boolean run(String[] args)
Runs a compilation session

Specified by:
run in class Compiler
Parameters:
args - the command line arguments
Returns:
true iff the compilation succeeded

parseArguments

public boolean parseArguments(String[] args)
Parse the argument list


genCode

public void genCode()
Generates the code from an array of compilation unit and a destination


initialize

protected void initialize()
Initialize the compiler (read classpath, check classes.zip)


verboseMode

public boolean verboseMode()
returns true iff compilation in verbose mode is requested.

Specified by:
verboseMode in class Compiler

getPrettyPrinter

public KjcPrettyPrinter getPrettyPrinter(String fileName)
...


parseFile

protected JCompilationUnit parseFile(File file)
parse the givven file and return a compilation unit side effect: increment error number

Parameters:
file - the name of the file (assert exists)
Returns:
the compilation unit defined by this file

checkInterface

protected void checkInterface(JCompilationUnit cunit)
check that interface of a given compilation unit is correct side effect: increment error number

Parameters:
cunit - the compilation unit

checkInitializers

protected void checkInitializers(JCompilationUnit cunit)
check that interface of a given compilation unit is correct side effect: increment error number

Parameters:
cunit - the compilation unit

checkBody

protected void checkBody(JCompilationUnit cunit)
check that body of a given compilation unit is correct side effect: increment error number

Parameters:
cunit - the compilation unit

generateJavaCode

protected void generateJavaCode(JCompilationUnit cunit)
generate the source code of parsed compilation unit

Parameters:
cunit - the compilation unit

parseMultiProc

protected void parseMultiProc(JCompilationUnit[] tree)
Parse each file in multi thread


checkBodyMultiProc

protected void checkBodyMultiProc(JCompilationUnit[] tree)

acceptMultiProc

protected void acceptMultiProc(JCompilationUnit[] tree)

genCodeMultiProc

protected void genCodeMultiProc(CSourceClass[] tree,
                                BytecodeOptimizer optimizer,
                                String destination)

reportTrouble

public void reportTrouble(PositionedError trouble)
Reports a trouble (error or warning).

Specified by:
reportTrouble in class Compiler
Parameters:
trouble - a description of the trouble to report.

reportTrouble

public void reportTrouble(UnpositionedError trouble)
Reports a trouble.

Parameters:
trouble - a description of the trouble to report.

filterWarning

protected boolean filterWarning(CWarning warning)

getFilter

protected WarningFilter getFilter()

parseComments

public boolean parseComments()
Returns true iff comments should be parsed (false if to be skipped)

Specified by:
parseComments in class Compiler

getClasses

public CSourceClass[] getClasses()
Returns the classes to generate