org.jruby.compiler
Interface ScriptCompiler

All Known Implementing Classes:
StandardASMCompiler

public interface ScriptCompiler

Compiler represents the current state of a compiler and all appropriate transitions and modifications that can be made within it. The methods here begin and end a class for a given compile run, begin and end methods for the script being compiled, set line number information, and generate code for all the basic operations necessary for a script to run. The intent of this interface is to provide a library-neutral set of functions for compiling a given script using any backend or any output format.


Method Summary
 void endScript(boolean generateLoad, boolean generateMain)
          End compilation for the current script, closing all context and structures used for the compilation.
 BodyCompiler startMethod(java.lang.String rubyName, java.lang.String javaName, CompilerCallback argsHandler, StaticScope scope, ASTInspector inspector)
          Begin compilation for a method that has the specified number of local variables.
 void startScript(StaticScope scope)
          Begin compilation for a script, preparing all necessary context and code to support this script's compiled representation.
 

Method Detail

startScript

void startScript(StaticScope scope)
Begin compilation for a script, preparing all necessary context and code to support this script's compiled representation.


endScript

void endScript(boolean generateLoad,
               boolean generateMain)
End compilation for the current script, closing all context and structures used for the compilation.


startMethod

BodyCompiler startMethod(java.lang.String rubyName,
                         java.lang.String javaName,
                         CompilerCallback argsHandler,
                         StaticScope scope,
                         ASTInspector inspector)
Begin compilation for a method that has the specified number of local variables. The returned value is a token that can be used to end the method later.

Parameters:
javaName - The outward user-readable name of the method. A unique name will be generated based on this.
arity - The arity of the method's argument list
localVarCount - The number of local variables that will be used by the method.
Returns:
An Object that represents the method within this compiler. Used in calls to endMethod once compilation for this method is completed.


Copyright © 2002-2007 JRuby Team. All Rights Reserved.