coins.driver
Class CompilerDriver

java.lang.Object
  extended bycoins.driver.CompilerDriver

public final class CompilerDriver
extends java.lang.Object

A framework of COINS compiler driver.
A CompilerDriver object represents an execution of whole compilation process which is divided into four passes: preprocess, compile, assemble and link. An object which implements CompilerImplementation must be provided to implement these four passes.
The semantics of driver control options such as -E, -c, -pipe, etc. are determined by this class.


Constructor Summary
CompilerDriver(CompileSpecification spec)
          Constructs a framework object.
 
Method Summary
static java.io.InputStream getAttachedFileInputStream(java.lang.Class clazz, java.lang.String path)
          Returns an InputStream of a file, which is in a directory where a loadable class file is in it (or one of sub-directories of the directory).
 int go(CompilerImplementation implementation)
          Drives compilation processes: preprocess, compile, assemble and link.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompilerDriver

public CompilerDriver(CompileSpecification spec)
Constructs a framework object.

Method Detail

getAttachedFileInputStream

public static java.io.InputStream getAttachedFileInputStream(java.lang.Class clazz,
                                                             java.lang.String path)
                                                      throws java.lang.ClassNotFoundException,
                                                             java.io.IOException
Returns an InputStream of a file, which is in a directory where a loadable class file is in it (or one of sub-directories of the directory). Note that the file and the directory may be on a jar/zip file.

Parameters:
clazz - a class object the class
path - a relative path of the directory where the file exists
Returns:
the InputStream object.
Throws:
java.io.IOException - failed to get InputStream
java.lang.ClassNotFoundException - failed to find `clazz' from class-path.

go

public int go(CompilerImplementation implementation)
Drives compilation processes: preprocess, compile, assemble and link.

Parameters:
implementation - a compiler implementation
Returns:
0 if no error, 1 otherwise