gnu.expr
public class Compilation extends Object implements SourceLocator
Field Summary | |
---|---|
static Type[] | apply0args |
static Method | apply0method |
static Type[] | apply1args |
static Method | apply1method |
static Type[] | apply2args |
static Method | apply2method |
static Method | apply3method |
static Method | apply4method |
static Method | applyCpsMethod |
static Method[] | applymethods |
static Type[] | applyNargs |
static Method | applyNmethod |
static Field | argsCallContextField |
static int | BODY_PARSED State code indicating the entire module has been parsed. |
String | classPrefix If non-null: a prefix for generateClassName to prepend to names. |
static String | classPrefixDefault |
ClassType | curClass |
LambdaExp | curLambda |
Options | currentOptions |
protected ScopeExp | current_scope |
static int | CALL_WITH_CONSUMER Function results are written to the current CallContext's Consumer. |
static int | CALL_WITH_CONTINUATIONS Support for full continuations. |
static int | CALL_WITH_RETURN Plain calling convention, using regular Java parameters and returns. |
static int | CALL_WITH_TAILCALLS Like CALL_WITH_CONSUMER, but handle full on-stack-growing tail-calls. |
static int | CALL_WITH_UNSPECIFIED |
static int | CLASS_WRITTEN State code indicating that bytecode has been written to its target. |
static int | COMPILED State code indicating the bytecode has been generated. |
static int | COMPILE_SETUP State code that various compile-only data has been determined. |
static boolean | debugPrintExpr If true, print out expressions after parsing and before optimizations. |
static boolean | debugPrintFinalExpr If true, print out final expressions after optimizations etc. |
static int | defaultCallConvention The default calling convention.
|
static boolean | emitSourceDebugExtAttr |
Stack | exprStack A help vector for building expressions. |
static int | ERROR_SEEN |
static Field | falseConstant |
static boolean | fewerClasses If true, minimize the number of classes generated.
|
boolean | generateApplet True if we should generate an Applet. |
static boolean | generateAppletDefault |
boolean | generateMain True if we should generate a main(String[]) method. |
static boolean | generateMainDefault |
boolean | generateServlet True if we should generate an Servlet. |
static boolean | generateServletDefault |
static Method | getCallContextInstanceMethod |
static Method | getCurrentEnvironmentMethod |
static Method | getLocation1EnvironmentMethod |
static Method | getLocation2EnvironmentMethod |
static Method | getLocationMethod |
static Method | getProcedureBindingMethod |
static Method | getSymbolProcedureMethod |
static Method | getSymbolValueMethod |
boolean | immediate True if the compiled result will be immediately loaded. |
static boolean | inlineOk |
static Type[] | int1Args |
static ClassType | javaIntegerType |
static ClassType | javaStringType |
protected Language | language |
Lexer | lexer |
NameLookup | lexical Current lexical scope - map name to Declaration. |
ClassType | mainClass |
ModuleExp | mainLambda |
protected SourceMessages | messages |
Method | method The current method. |
ModuleInfo | minfo |
ClassType | moduleClass Generated class that extends ModuleBody. |
static int | moduleStatic If moduleStatic > 0, (module-static #t) is implied by default.
|
boolean | mustCompile True if the form is too complex to evaluate,and we must compile it.
|
static Field | noArgsField |
static ArrayType | objArrayType |
static Options | options |
static Field | pcCallContextField |
Stack | pendingImports |
static Field | procCallContextField |
static int | PROLOG_PARSED We have determined the module name and class, but not finished parsing. |
static int | PROLOG_PARSING State code for initial pre-parse looking for module name. |
static int | RESOLVED State code for lexical bindings having been resolved. |
static ClassType | scmBooleanType |
static ClassType | scmKeywordType |
static ClassType | scmListType |
static ClassType | scmNamedType |
static ClassType | scmPairType |
static ClassType | scmSequenceType |
static Type[] | string1Arg |
static Type[] | sym1Arg |
Variable | thisDecl |
static Field | trueConstant |
static ClassType | typeApplet |
static ClassType | typeCallContext |
static ClassType | typeClass |
static ClassType | typeClassType |
static ClassType | typeConsumer |
static ClassType | typeEnvironment |
static ClassType | typeLanguage |
static ClassType | typeLocation |
static ClassType | typeMethodProc |
static ClassType | typeModuleBody |
static ClassType | typeModuleMethod |
static ClassType | typeModuleWithContext |
static ClassType | typeObject |
static ClassType | typeObjectType |
static ClassType | typePair |
static ClassType | typeProcedure |
static ClassType | typeProcedure0 |
static ClassType | typeProcedure1 |
static ClassType | typeProcedure2 |
static ClassType | typeProcedure3 |
static ClassType | typeProcedure4 |
static ClassType[] | typeProcedureArray |
static ClassType | typeProcedureN |
static ClassType | typeRunnable |
static ClassType | typeServlet |
static ClassType | typeString |
static ClassType | typeSymbol |
static ClassType | typeType |
static ClassType | typeValues |
static int | WALKED State code when various inlining and optimization passes are done. |
Constructor Summary | |
---|---|
Compilation(boolean immediate, SourceMessages messages) | |
Compilation(SourceMessages messages) | |
Compilation(Language language, SourceMessages messages) | |
Compilation(Language language, SourceMessages messages, NameLookup lexical) |
Method Summary | |
---|---|
void | addClass(ClassType new_class) |
void | addMainClass(ModuleExp module) |
Field | allocLocalField(Type type, String name) |
void | compileConstant(Object value) Emit code to "evaluate" a compile-time constant.
|
void | compileConstant(Object value, Target target) |
Field | compileConstantToField(Object value) |
void | compileToArchive(ModuleExp mexp, String fname) |
LambdaExp | currentLambda() |
ModuleExp | currentModule() The same as getModule, until we allow nested modules. |
ScopeExp | currentScope() |
static char | demangle2(char char1, char char2) Demangle a three-character mangling starting with '$'.
|
static String | demangleName(String name) |
static String | demangleName(String name, boolean reversible) |
void | error(char severity, String message, SourceLocator location) |
void | error(char severity, String message) |
void | error(char severity, Declaration decl, String msg1, String msg2) |
void | error(char severity, String message, String code, Declaration decl) |
static Compilation | findForImmediateLiterals(int key) |
ClassType | findNamedClass(String name) Search this Compilation for a ClassType with a given name. |
void | freeLocalField(Field field) |
void | generateApplyMethodsWithContext(LambdaExp lexp) Generate ModuleBody's apply(CallContext) method
Use the applyMethods vector, which contains methods that
implement the (public, readable) methods of the current module. |
void | generateApplyMethodsWithoutContext(LambdaExp lexp) Generate ModuleBody's apply0...applyN methods.
|
String | generateClassName(String hint) Generate an unused class name. |
void | generateConstructor(LambdaExp lexp) |
void | generateConstructor(ClassType clas, LambdaExp lexp) |
void | generateMatchMethods(LambdaExp lexp) |
boolean | getBooleanOption(String key, boolean defaultValue) Get a named boolean option. |
boolean | getBooleanOption(String key) Get a named boolean option. |
CodeAttr | getCode() |
int | getColumnNumber() |
Method | getConstructor(LambdaExp lexp) |
static Method | getConstructor(ClassType clas, LambdaExp lexp) |
static Compilation | getCurrent() |
String | getFileName() |
Method | getForNameHelper() Generate a method to find a named Class without initializing it.
|
Language | getLanguage() |
int | getLineNumber() |
SourceMessages | getMessages() |
ModuleExp | getModule() |
ClassType | getModuleType() |
String | getPublicId() |
int | getState() Returns a code indicating how far along
we are in the parsing/compilation process. |
String | getSystemId() |
boolean | inlineOk(Expression proc) |
boolean | inlineOk(Procedure proc) |
boolean | isPedantic() |
boolean | isStableSourceLocation() |
boolean | isStatic() |
static boolean | isValidJavaName(String name) |
LetExp | letDone(Expression body) |
void | letEnter() |
void | letStart() |
Declaration | letVariable(Object name, Type type, Expression init) |
void | loadCallContext() Generate code to push the current CallContext on the JVM stack. |
void | loadClassRef(ClassType clas) |
void | loadClassRef(String className) Generate code to load a named Class without initializing it. |
Declaration | lookup(Object name, int namespace) |
void | loopBody(Expression body) |
void | loopCond(Expression cond) |
void | loopEnter() Done handling loop variables, and pushes them into the lexical scope.
|
Expression | loopRepeat(Expression[] exps) |
Expression | loopRepeat() |
Expression | loopRepeat(Expression exp) |
void | loopStart() Start a new loop.
|
Declaration | loopVariable(Object name, Type type, Expression init) |
static String | mangleName(String name) |
static String | mangleName(String name, boolean reversible) Convert a string to a safe Java identifier. |
static String | mangleName(String name, int kind) Convert a string to a safe Java identifier. |
static String | mangleNameIfNeeded(String name) |
static String | mangleURI(String name) Map a URI to a package/class name.
|
void | mustCompileHere() Note that we have seen a construct that must be compiled, not evaluated.
|
void | outputClass(String directory) |
Expression | parse(Object input) This may not make sense, except for Lisp-like languages.
|
void | pop(ScopeExp scope) |
void | pop() |
void | process(int wantedState) Parse/walk/compile this module as needed and requested.
|
void | push(ScopeExp scope) |
void | push(Declaration decl) |
ModuleExp | pushNewModule(Lexer lexer) |
ModuleExp | pushNewModule(String filename) |
void | pushPendingImport(ModuleInfo info, ScopeExp defs) |
void | pushScope(ScopeExp scope) |
static int | registerForImmediateLiterals(Compilation comp) |
Object | resolve(Object name, boolean function) |
void | setColumn(int column) |
static void | setCurrent(Compilation comp) |
void | setCurrentScope(ScopeExp scope) Set currentScope() .
|
void | setFile(String filename) |
void | setLine(int line) |
void | setLine(Expression position) |
void | setLine(Object location) |
void | setLine(String filename, int line, int column) |
void | setLocation(SourceLocator position) |
void | setMessages(SourceMessages messages) |
void | setModule(ModuleExp mexp) |
void | setState(int state) |
static void | setupLiterals(int key) Call-back from compiled code to initialize literals in immediate mode.
|
Expression | syntaxError(String message)
Handle syntax errors (at rewrite time). |
String | toString() |
void | usedClass(Type type) Called for classes referenced in bytecode.
|
boolean | usingCPStyle() |
boolean | usingTailCalls() |
void | walkModule(ModuleExp mexp) Shared processing for both compiling/eval. |
Parameters: value the value to be compiled
Parameters: name the name of the class desired
Returns: the matching ClassType, or null if none is found
Parameters: hint the requested name (or prefix)
Returns: a unique class name.
Parameters: reversible if we should use an invertible mapping.
Parameters: kind -1 - non-reversible; 0: reversible, except that '$' is not mapped; 1: reversible
Parameters: wantedState the desired value of getState().
currentScope()
.
Also update the nesting
object.Parameters: message an error message to print out
Returns: an ErrorExp