at.dms.kjc
Class Main

java.lang.Object
  |
  +--at.dms.compiler.Compiler
        |
        +--at.dms.kjc.Main

public class Main
extends Compiler

The entry point of the compiler, containing the main method.


Inner Class Summary
(package private) static class Main.ThreadedChecker
           
(package private) static class Main.ThreadedGenerator
           
(package private) static class Main.ThreadedParser
          Helper class that implements multithreaded parsing.
(package private) static class Main.ThreadedVisitor
           
 
Field Summary
protected  boolean errorFound
          Was there at least one error.
protected  java.util.List infiles
          Files to compiler.
protected  KjcOptions options
          Command-line 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
protected  void checkTransformedInterfaces(JCompilationUnit cunit)
          check that interface of the transformed types in a given compilation unit is correct side effect: increment error number
protected  void checkTransformedTypesBody(JCompilationUnit cunit)
          check that body of a given compilation unit is correct side effect: increment error number
static boolean compile(java.lang.String[] args)
          Second entry point
protected  boolean filterWarning(CWarning warning)
           
 void genCode(java.lang.String destination)
          Generates the code from an array of compilation unit and a destination
protected  void genCodeMultiProc(CSourceClass[] tree, java.lang.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(java.lang.String fileName)
          Shows an error/warning and set error flag to true
protected  void initialize()
          Initialize the compiler (read classpath, check classes.zip)
static void main(java.lang.String[] args)
          Entry point
 int optimizeCode()
           
 boolean parseArguments(java.lang.String[] args)
          Parse the argument list.
 boolean parseComments()
          Returns true iff comments should be parsed (false if to be skipped)
protected  JCompilationUnit parseFile(java.io.File file)
          parse the given file and return a compilation unit.
protected  void parseMultiProc(JCompilationUnit[] tree)
          Parse each file in multi thread
 void reportTrouble(PositionedError trouble)
          Reports a trouble (error or warning).
 boolean run(java.lang.String[] args)
          Runs a compilation session.
protected  void transformTypes(JCompilationUnit cunit)
          Transform classes before code generation.
 boolean verboseMode()
          Returns true iff compilation runs in verbose mode.
 
Methods inherited from class at.dms.compiler.Compiler
checkDestination, getTimestamp, inform, inform, inform, inform, inform, inform, inform, run, setDebug, setErr, setWorkingDirectory, verifyFiles
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

infiles

protected java.util.List infiles
Files to compiler.

errorFound

protected boolean errorFound
Was there at least one error.

options

protected KjcOptions options
Command-line options.
Constructor Detail

Main

public Main()
Method Detail

run

public boolean run(java.lang.String[] args)
Runs a compilation session.
Overrides:
run in class Compiler
Parameters:
args - The command line arguments.

parseArguments

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

genCode

public void genCode(java.lang.String destination)
Generates the code from an array of compilation unit and a destination
Parameters:
destination - the directory where to write classfiles

initialize

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

verboseMode

public boolean verboseMode()
Description copied from class: Compiler
Returns true iff compilation runs in verbose mode.
Overrides:
verboseMode in class Compiler
Returns:
true if compilation in verbose mode

optimizeCode

public int optimizeCode()
Returns:
the optimization level

getPrettyPrinter

public KjcPrettyPrinter getPrettyPrinter(java.lang.String fileName)
Shows an error/warning and set error flag to true

main

public static void main(java.lang.String[] args)
Entry point
Parameters:
args - the command line arguments

compile

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

parseFile

protected JCompilationUnit parseFile(java.io.File file)
parse the given 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.

checkTransformedInterfaces

protected void checkTransformedInterfaces(JCompilationUnit cunit)
check that interface of the transformed types in a given compilation unit is correct side effect: increment error number
Parameters:
cunit - the compilation unit

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

transformTypes

protected void transformTypes(JCompilationUnit cunit)
Transform classes before code generation. 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

checkTransformedTypesBody

protected void checkTransformedTypesBody(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,
                                java.lang.String destination)

reportTrouble

public void reportTrouble(PositionedError trouble)
Reports a trouble (error or warning).
Overrides:
reportTrouble in class Compiler
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)
Overrides:
parseComments in class Compiler

getClasses

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