jltools.frontend
Class Compiler

java.lang.Object
  |
  +--jltools.frontend.Compiler

public class Compiler
extends java.lang.Object

This is the main entry point for the compiler. It contains a work list that contains entries for all classes that must be compiled (or otherwise worked on).


Field Summary
protected  NodeFactory node_factory
          The node factory creates AST node objects.
protected  SourceLoader source_loader
          The source loader is responsible for loading source files from the source path.
protected  TargetFactory target_factory
          The target factory is responsible for naming and opening output files given a package name and a class or source file name.
protected  TypeSystem type_system
          The type system.
 
Constructor Summary
Compiler(Options options_)
          Initialize the compiler.
 
Method Summary
 void addPass(Pass pass)
          Add a pass to the worklist.
 boolean compile(java.util.Collection sources)
          Compile all the files listed in the set of strings source.
 ErrorQueue errorQueue()
          Get the compiler's error queue.
 ExtensionInfo extensionInfo()
          Get information about the language extension being compiled.
protected  boolean finish()
          Run all jobs in the worklist to completion.
 Job jobForSource(Source source)
          Get a job for the source.
 java.util.Collection jobs()
          Return a collection of all jobs in the compilation.
 LoadedClassResolver loadedResolver()
          Get the compiler's parsed-file resolver
 NodeFactory nodeFactory()
          Get the compiler's node extension factory
 java.util.Collection outputFiles()
          Return a set of output filenames resulting from a compilation.
 int outputWidth()
          Maximum number of characters on each line of output
 TableResolver parsedResolver()
          Get the compiler's parsed-file resolver
 boolean readClass(java.lang.String className)
          Compile the source file for a given class to completion.
 boolean readSource(Source source)
          Compile a source file until the types in the source file are constructed.
static void report(int level, java.lang.String msg)
          Debug reporting for the frontend.
static void reportTime(int level, java.lang.String msg)
          Reports the time taken by every pass.
 boolean runToPass(Pass goal)
          Run all passes in the worklist until the goal pass completes.
 boolean serializeClassInfo()
          Should class info be serialized into the output?
 SourceLoader sourceLoader()
          Get the compiler's source loader
 Resolver systemResolver()
          Get the compiler's system resolver
 TargetFactory targetFactory()
          Get the compiler's target factory
 TypeSystem typeSystem()
          Get the compiler's type system
 boolean useFullyQualifiedNames()
          Should fully qualified class names be used in the output?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type_system

protected TypeSystem type_system
The type system.

node_factory

protected NodeFactory node_factory
The node factory creates AST node objects.

source_loader

protected SourceLoader source_loader
The source loader is responsible for loading source files from the source path.

target_factory

protected TargetFactory target_factory
The target factory is responsible for naming and opening output files given a package name and a class or source file name.
Constructor Detail

Compiler

public Compiler(Options options_)
Initialize the compiler.
Parameters:
options - Contains jltools options
Method Detail

outputFiles

public java.util.Collection outputFiles()
Return a set of output filenames resulting from a compilation.

readSource

public boolean readSource(Source source)
                   throws java.io.IOException
Compile a source file until the types in the source file are constructed.

readClass

public boolean readClass(java.lang.String className)
                  throws java.io.IOException
Compile the source file for a given class to completion.

jobForSource

public Job jobForSource(Source source)
Get a job for the source.

jobs

public java.util.Collection jobs()
Return a collection of all jobs in the compilation.

compile

public boolean compile(java.util.Collection sources)
Compile all the files listed in the set of strings source. Return true on success. The method outputFiles can be used to obtain the output of the compilation. This is the main entry point for the compiler, called from main().

addPass

public void addPass(Pass pass)
Add a pass to the worklist.

runToPass

public boolean runToPass(Pass goal)
Run all passes in the worklist until the goal pass completes.

finish

protected boolean finish()
Run all jobs in the worklist to completion.

useFullyQualifiedNames

public boolean useFullyQualifiedNames()
Should fully qualified class names be used in the output?

sourceLoader

public SourceLoader sourceLoader()
Get the compiler's source loader

targetFactory

public TargetFactory targetFactory()
Get the compiler's target factory

nodeFactory

public NodeFactory nodeFactory()
Get the compiler's node extension factory

typeSystem

public TypeSystem typeSystem()
Get the compiler's type system

extensionInfo

public ExtensionInfo extensionInfo()
Get information about the language extension being compiled.

systemResolver

public Resolver systemResolver()
Get the compiler's system resolver

loadedResolver

public LoadedClassResolver loadedResolver()
Get the compiler's parsed-file resolver

parsedResolver

public TableResolver parsedResolver()
Get the compiler's parsed-file resolver

outputWidth

public int outputWidth()
Maximum number of characters on each line of output

serializeClassInfo

public boolean serializeClassInfo()
Should class info be serialized into the output?

errorQueue

public ErrorQueue errorQueue()
Get the compiler's error queue.

report

public static void report(int level,
                          java.lang.String msg)
Debug reporting for the frontend.

reportTime

public static void reportTime(int level,
                              java.lang.String msg)
Reports the time taken by every pass.