polyglot.frontend
Class AbstractExtensionInfo

java.lang.Object
  extended by polyglot.frontend.AbstractExtensionInfo
All Implemented Interfaces:
ExtensionInfo
Direct Known Subclasses:
JLExtensionInfo

public abstract class AbstractExtensionInfo
extends java.lang.Object
implements ExtensionInfo

This is an abstract ExtensionInfo.


Field Summary
protected  Compiler compiler
           
protected  NodeFactory nf
           
protected  Scheduler scheduler
           
protected  SourceLoader source_loader
           
protected  Stats stats
           
protected  TargetFactory target_factory
           
protected  TypeSystem ts
           
 
Constructor Summary
AbstractExtensionInfo()
           
 
Method Summary
 Compiler compiler()
           
abstract  java.lang.String compilerName()
          The name of the compiler for usage messages
 ClassFile createClassFile(java.io.File classFileSource, byte[] code)
          Create class file
 FileSource createFileSource(java.io.File f, boolean user)
          Create file source for a file.
protected abstract  NodeFactory createNodeFactory()
          Create the node factory for this extension.
protected  Options createOptions()
           
protected abstract  Scheduler createScheduler()
           
protected abstract  TypeSystem createTypeSystem()
          Create the type system for this extension.
abstract  java.lang.String defaultFileExtension()
          The default extension that source files are expected to have.
 java.lang.String[] defaultFileExtensions()
          Get the default list of file extensions.
 java.lang.String[] fileExtensions()
          Get the file name extension of source files.
abstract  Goal getCompileGoal(Job job)
          Return the goal for compiling a particular compilation unit.
 Options getOptions()
          Return an Options object, which will be given the command line to parse.
 Stats getStats()
          Return a Stats object to accumulate and report statistics.
 void initCompiler(Compiler compiler)
          Initialize the extension with a particular compiler.
protected abstract  void initTypeSystem()
           
 JobExt jobExt()
          Get the job extension for this language extension.
 NodeFactory nodeFactory()
          Get the AST node factory for this extension.
abstract  Parser parser(java.io.Reader reader, FileSource source, ErrorQueue eq)
          Get the parser for this language extension.
 Scheduler scheduler()
          Returns the pass scheduler.
 SourceLoader sourceLoader()
          Get the source file loader object for this extension.
 TargetFactory targetFactory()
          Get the target factory object for this extension.
 java.lang.String toString()
           
 TypeSystem typeSystem()
          Get the type system for this extension.
abstract  Version version()
          Report the version of the extension.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

compiler

protected Compiler compiler

ts

protected TypeSystem ts

nf

protected NodeFactory nf

source_loader

protected SourceLoader source_loader

target_factory

protected TargetFactory target_factory

stats

protected Stats stats

scheduler

protected Scheduler scheduler
Constructor Detail

AbstractExtensionInfo

public AbstractExtensionInfo()
Method Detail

getCompileGoal

public abstract Goal getCompileGoal(Job job)
Description copied from interface: ExtensionInfo
Return the goal for compiling a particular compilation unit. The goal may have subgoals on which it depends.

Specified by:
getCompileGoal in interface ExtensionInfo

compilerName

public abstract java.lang.String compilerName()
Description copied from interface: ExtensionInfo
The name of the compiler for usage messages

Specified by:
compilerName in interface ExtensionInfo

defaultFileExtension

public abstract java.lang.String defaultFileExtension()
Description copied from interface: ExtensionInfo
The default extension that source files are expected to have.

Specified by:
defaultFileExtension in interface ExtensionInfo

version

public abstract Version version()
Description copied from interface: ExtensionInfo
Report the version of the extension.

Specified by:
version in interface ExtensionInfo

getOptions

public Options getOptions()
Description copied from interface: ExtensionInfo
Return an Options object, which will be given the command line to parse.

Specified by:
getOptions in interface ExtensionInfo

createOptions

protected Options createOptions()

getStats

public Stats getStats()
Return a Stats object to accumulate and report statistics.

Specified by:
getStats in interface ExtensionInfo

compiler

public Compiler compiler()
Specified by:
compiler in interface ExtensionInfo

initCompiler

public void initCompiler(Compiler compiler)
Description copied from interface: ExtensionInfo
Initialize the extension with a particular compiler. This must be called after the compiler is initialized, but before the compiler starts work.

Specified by:
initCompiler in interface ExtensionInfo

initTypeSystem

protected abstract void initTypeSystem()

fileExtensions

public java.lang.String[] fileExtensions()
Get the file name extension of source files. This is either the language extension's default file name extension or the string passed in with the "-sx" command-line option.

Specified by:
fileExtensions in interface ExtensionInfo

defaultFileExtensions

public java.lang.String[] defaultFileExtensions()
Get the default list of file extensions.

Specified by:
defaultFileExtensions in interface ExtensionInfo

sourceLoader

public SourceLoader sourceLoader()
Get the source file loader object for this extension.

Specified by:
sourceLoader in interface ExtensionInfo

targetFactory

public TargetFactory targetFactory()
Get the target factory object for this extension.

Specified by:
targetFactory in interface ExtensionInfo

createScheduler

protected abstract Scheduler createScheduler()

scheduler

public Scheduler scheduler()
Description copied from interface: ExtensionInfo
Returns the pass scheduler.

Specified by:
scheduler in interface ExtensionInfo

createTypeSystem

protected abstract TypeSystem createTypeSystem()
Create the type system for this extension.


typeSystem

public TypeSystem typeSystem()
Get the type system for this extension.

Specified by:
typeSystem in interface ExtensionInfo

createNodeFactory

protected abstract NodeFactory createNodeFactory()
Create the node factory for this extension.


nodeFactory

public NodeFactory nodeFactory()
Get the AST node factory for this extension.

Specified by:
nodeFactory in interface ExtensionInfo

jobExt

public JobExt jobExt()
Get the job extension for this language extension. The job extension is used to extend the Job class without subtyping.

Specified by:
jobExt in interface ExtensionInfo

parser

public abstract Parser parser(java.io.Reader reader,
                              FileSource source,
                              ErrorQueue eq)
Get the parser for this language extension.

Specified by:
parser in interface ExtensionInfo

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createClassFile

public ClassFile createClassFile(java.io.File classFileSource,
                                 byte[] code)
Description copied from interface: ExtensionInfo
Create class file

Specified by:
createClassFile in interface ExtensionInfo

createFileSource

public FileSource createFileSource(java.io.File f,
                                   boolean user)
                            throws java.io.IOException
Description copied from interface: ExtensionInfo
Create file source for a file. The main purpose is to allow the character encoding to be defined.

Specified by:
createFileSource in interface ExtensionInfo
Throws:
java.io.IOException