jltools.frontend
Interface ExtensionInfo

All Known Implementing Classes:
ExtensionInfo

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
 java.lang.String compilerName()
          The name of the compiler for usage messages
 Job createJob(Source source)
          Produce a job used to compile the given source.
 java.lang.String fileExtension()
          The default extension that source files are expected to have
 void initCompiler(Compiler compiler)
          Initialize the extension with a particular compiler.
 NodeFactory nodeFactory()
          Produce a node factory for this language extension.
 java.lang.String options()
          Report the options accepted by the extension.
 int parseCommandLine(java.lang.String[] args, int index, Options options)
          Parse as much of the command line as this extension understands, up to the first source file.
 Parser parser(java.io.Reader reader, Job job)
          Get a parser for this language extension.
 void setOptions(Options options)
          Initialize the extension with the command-line options.
 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

parseCommandLine

public int parseCommandLine(java.lang.String[] args,
                            int index,
                            Options options)
                     throws UsageError
Parse as much of the command line as this extension understands, up to the first source file. Return the index of the first switch not understood by the extension, or of the first source file, or args.length if neither.

setOptions

public void setOptions(Options options)
                throws UsageError
Initialize the extension with the command-line options. This must be called before any other method of the extension except the command-line parsing methods: compilerName() options() parseCommandLine()

compilerName

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

version

public Version version()
Report the version of the extension.

options

public java.lang.String options()
Report the options accepted by the extension. Output is newline-terminated if non-empty.

initCompiler

public 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.

fileExtension

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

typeSystem

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

nodeFactory

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

sourceLoader

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

createJob

public Job createJob(Source source)
Produce a job used to compile the given source.

targetFactory

public TargetFactory targetFactory()
Produce a target factory for this language extension.

parser

public Parser parser(java.io.Reader reader,
                     Job job)
Get a parser for this language extension.