polyglot.frontend
Interface ExtensionInfo

All Known Implementing Classes:
AbstractExtensionInfo, ExtensionInfo, ExtensionInfo, ExtensionInfo, JLExtensionInfo

public interface ExtensionInfo

ExtensionInfo is the main interface for defining language extensions. The frontend will load the ExtensionInfo specified on the command-line. It defines the type system, AST node factory, parser, and other parameters of a language extension.


Method Summary
 Compiler compiler()
           
 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 sourceFile, boolean userSpecified)
          Create file source for a file.
 java.lang.String defaultFileExtension()
          The default extension that source files are expected to have.
 java.lang.String[] defaultFileExtensions()
          The default extensions that source files are expected to have.
 java.lang.String[] fileExtensions()
          The extensions that source files are expected to have.
 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.
 JobExt jobExt()
          Get the job extension for this language extension.
 NodeFactory nodeFactory()
          Produce a node factory for this language extension.
 Parser parser(java.io.Reader reader, FileSource source, ErrorQueue eq)
          Get a parser for this language extension.
 Scheduler scheduler()
          Returns the pass scheduler.
 SourceLoader sourceLoader()
          Produce a source factory for this language extension.
 TargetFactory targetFactory()
          Produce a target factory for this language extension.
 TypeSystem typeSystem()
          Produce a type system for this language extension.
 Version version()
          Report the version of the extension.
 

Method Detail

compilerName

java.lang.String compilerName()
The name of the compiler for usage messages


version

Version version()
Report the version of the extension.


scheduler

Scheduler scheduler()
Returns the pass scheduler.


getCompileGoal

Goal getCompileGoal(Job job)
Return the goal for compiling a particular compilation unit. The goal may have subgoals on which it depends.


getOptions

Options getOptions()
Return an Options object, which will be given the command line to parse.


getStats

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


initCompiler

void initCompiler(Compiler compiler)
Initialize the extension with a particular compiler. This must be called after the compiler is initialized, but before the compiler starts work.


compiler

Compiler compiler()

fileExtensions

java.lang.String[] fileExtensions()
The extensions that source files are expected to have. Defaults to the array defaultFileExtensions.


defaultFileExtensions

java.lang.String[] defaultFileExtensions()
The default extensions that source files are expected to have. Defaults to an array containing defaultFileExtension


defaultFileExtension

java.lang.String defaultFileExtension()
The default extension that source files are expected to have.


typeSystem

TypeSystem typeSystem()
Produce a type system for this language extension.


nodeFactory

NodeFactory nodeFactory()
Produce a node factory for this language extension.


sourceLoader

SourceLoader sourceLoader()
Produce a source factory for this language extension.


jobExt

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


targetFactory

TargetFactory targetFactory()
Produce a target factory for this language extension. The target factory is responsible for naming and opening output files given a package name and a class or source file name.


parser

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


createClassFile

ClassFile createClassFile(java.io.File classFileSource,
                          byte[] code)
Create class file


createFileSource

FileSource createFileSource(java.io.File sourceFile,
                            boolean userSpecified)
                            throws java.io.IOException
Create file source for a file. The main purpose is to allow the character encoding to be defined.

Throws:
java.io.IOException