gnu.expr

Class Compilation

Implemented Interfaces:
org.xml.sax.Locator, SourceLocator
Known Direct Subclasses:
Translator

public class Compilation
extends java.lang.Object
implements SourceLocator

State for a single expression or module. For each top-level thing (expression or file) we compile or evaluate we create a new Compilation.

Field Summary

static int
BODY_PARSED
State code indicating the entire module has been parsed.
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 int
ERROR_SEEN
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 int
WALKED
State code when various inlining and optimization passes are done.
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 Type[]
applyNargs
static Method
applyNmethod
static Method[]
applymethods
static Field
argsCallContextField
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 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 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 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

Constructor Summary

Compilation(boolean immediate, SourceMessages messages)
Compilation(Language language, SourceMessages messages)
Compilation(Language language, SourceMessages messages, NameLookup lexical)
Compilation(SourceMessages messages)

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)
void
error(char severity, String message, String code, Declaration decl)
void
error(char severity, String message, SourceLocator location)
void
error(char severity, Declaration decl, String msg1, String msg2)
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(ClassType clas, LambdaExp lexp)
void
generateConstructor(LambdaExp lexp)
void
generateMatchMethods(LambdaExp lexp)
boolean
getBooleanOption(String key)
Get a named boolean option.
boolean
getBooleanOption(String key, boolean defaultValue)
Get a named boolean option.
CodeAttr
getCode()
int
getColumnNumber()
Return current column number.
static Method
getConstructor(ClassType clas, LambdaExp lexp)
Method
getConstructor(LambdaExp lexp)
static Compilation
getCurrent()
String
getFileName()
Normally same as getSystemId.
Method
getForNameHelper()
Generate a method to find a named Class without initializing it.
Language
getLanguage()
int
getLineNumber()
Return current line number.
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()
True if position is unlikely to change.
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(String className)
Generate code to load a named Class without initializing it.
void
loadClassRef(ClassType clas)
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
loopRepeat(Expression exp)
Expression
loopRepeat(Expression[] exps)
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()
void
pop(ScopeExp scope)
void
process(int wantedState)
Parse/walk/compile this module as needed and requested.
void
push(Declaration decl)
void
push(ScopeExp scope)
ModuleExp
pushNewModule(String filename)
ModuleExp
pushNewModule(Lexer lexer)
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(Object location)
void
setLine(String filename, int line, int column)
void
setLine(Expression position)
void
setLine(int line)
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.

Field Details

BODY_PARSED

public static final int BODY_PARSED
State code indicating the entire module has been parsed.
Field Value:
4

CALL_WITH_CONSUMER

public static final int CALL_WITH_CONSUMER
Function results are written to the current CallContext's Consumer.
Field Value:
2

CALL_WITH_CONTINUATIONS

public static final int CALL_WITH_CONTINUATIONS
Support for full continuations. Not implemented.
Field Value:
4

CALL_WITH_RETURN

public static final int CALL_WITH_RETURN
Plain calling convention, using regular Java parameters and returns.
Field Value:
1

CALL_WITH_TAILCALLS

public static final int CALL_WITH_TAILCALLS
Like CALL_WITH_CONSUMER, but handle full on-stack-growing tail-calls.
Field Value:
3

CALL_WITH_UNSPECIFIED

public static final int CALL_WITH_UNSPECIFIED
Field Value:
0

CLASS_WRITTEN

public static final int CLASS_WRITTEN
State code indicating that bytecode has been written to its target.
Field Value:
14

COMPILED

public static final int COMPILED
State code indicating the bytecode has been generated.
Field Value:
12

COMPILE_SETUP

public static final int COMPILE_SETUP
State code that various compile-only data has been determined.
Field Value:
10

ERROR_SEEN

public static final int ERROR_SEEN
Field Value:
100

PROLOG_PARSED

public static final int PROLOG_PARSED
We have determined the module name and class, but not finished parsing.
Field Value:
2

PROLOG_PARSING

public static final int PROLOG_PARSING
State code for initial pre-parse looking for module name.
Field Value:
1

RESOLVED

public static final int RESOLVED
State code for lexical bindings having been resolved.
Field Value:
6

WALKED

public static final int WALKED
State code when various inlining and optimization passes are done.
Field Value:
8

apply0args

public static Type[] apply0args

apply0method

public static Method apply0method

apply1args

public static Type[] apply1args

apply1method

public static Method apply1method

apply2args

public static Type[] apply2args

apply2method

public static Method apply2method

apply3method

public static Method apply3method

apply4method

public static Method apply4method

applyCpsMethod

public static Method applyCpsMethod

applyNargs

public static Type[] applyNargs

applyNmethod

public static Method applyNmethod

applymethods

public static Method[] applymethods

argsCallContextField

public static Field argsCallContextField

classPrefix

public String classPrefix
If non-null: a prefix for generateClassName to prepend to names.

classPrefixDefault

public static String classPrefixDefault

curClass

public ClassType curClass

curLambda

public LambdaExp curLambda

currentOptions

public Options currentOptions

current_scope

protected ScopeExp current_scope

debugPrintExpr

public static boolean debugPrintExpr
If true, print out expressions after parsing and before optimizations.

debugPrintFinalExpr

public static boolean debugPrintFinalExpr
If true, print out final expressions after optimizations etc.

defaultCallConvention

public static int defaultCallConvention
The default calling convention. One of the following CALL_WITHG_xxx values.

emitSourceDebugExtAttr

public static boolean emitSourceDebugExtAttr

exprStack

public Stack exprStack
A help vector for building expressions.

falseConstant

public static final Field falseConstant

fewerClasses

public static boolean fewerClasses
If true, minimize the number of classes generated. Do this even if it makes things a little slower.

generateApplet

public boolean generateApplet
True if we should generate an Applet.

generateAppletDefault

public static boolean generateAppletDefault

generateMain

public boolean generateMain
True if we should generate a main(String[]) method.

generateMainDefault

public static boolean generateMainDefault

generateServlet

public boolean generateServlet
True if we should generate an Servlet.

generateServletDefault

public static boolean generateServletDefault

getCallContextInstanceMethod

public static Method getCallContextInstanceMethod

getCurrentEnvironmentMethod

public static Method getCurrentEnvironmentMethod

getLocation1EnvironmentMethod

public static final Method getLocation1EnvironmentMethod

getLocation2EnvironmentMethod

public static final Method getLocation2EnvironmentMethod

getLocationMethod

public static final Method getLocationMethod

getProcedureBindingMethod

public static final Method getProcedureBindingMethod

getSymbolProcedureMethod

public static final Method getSymbolProcedureMethod

getSymbolValueMethod

public static final Method getSymbolValueMethod

immediate

public boolean immediate
True if the compiled result will be immediately loaded.

inlineOk

public static boolean inlineOk

int1Args

public static final Type[] int1Args

javaIntegerType

public static ClassType javaIntegerType

javaStringType

public static ClassType javaStringType

language

protected Language language

lexer

public Lexer lexer

lexical

public NameLookup lexical
Current lexical scope - map name to Declaration.

mainClass

public ClassType mainClass

mainLambda

public ModuleExp mainLambda

messages

protected SourceMessages messages

method

public Method method
The current method.

minfo

public ModuleInfo minfo

moduleClass

public ClassType moduleClass
Generated class that extends ModuleBody. Normally same as mainClass.

moduleStatic

public static int moduleStatic
If moduleStatic > 0, (module-static #t) is implied by default. If moduleStatic == 2, calls run. If moduleStatic <320, (module-static #f) is implied by default.

mustCompile

public boolean mustCompile
True if the form is too complex to evaluate,and we must compile it. This is because it contains a construct we know how to compile, but not evaluate, and it it outside a function (which we always compile). This can be a let scope, or primitive procedure.

noArgsField

public static Field noArgsField

objArrayType

public static final ArrayType objArrayType

options

public static Options options

pcCallContextField

public static Field pcCallContextField

pendingImports

public Stack pendingImports

procCallContextField

public static Field procCallContextField

scmBooleanType

public static ClassType scmBooleanType

scmKeywordType

public static ClassType scmKeywordType

scmListType

public static ClassType scmListType

scmNamedType

public static ClassType scmNamedType

scmPairType

public static ClassType scmPairType

scmSequenceType

public static ClassType scmSequenceType

string1Arg

public static final Type[] string1Arg

sym1Arg

public static final Type[] sym1Arg

thisDecl

public Variable thisDecl

trueConstant

public static final Field trueConstant

typeApplet

public static ClassType typeApplet

typeCallContext

public static ClassType typeCallContext

typeClass

public static ClassType typeClass

typeClassType

public static ClassType typeClassType

typeConsumer

public static final ClassType typeConsumer

typeEnvironment

public static ClassType typeEnvironment

typeLanguage

public static ClassType typeLanguage

typeLocation

public static ClassType typeLocation

typeMethodProc

public static ClassType typeMethodProc

typeModuleBody

public static ClassType typeModuleBody

typeModuleMethod

public static ClassType typeModuleMethod

typeModuleWithContext

public static ClassType typeModuleWithContext

typeObject

public static ClassType typeObject

typeObjectType

public static ClassType typeObjectType

typePair

public static ClassType typePair

typeProcedure

public static ClassType typeProcedure

typeProcedure0

public static ClassType typeProcedure0

typeProcedure1

public static ClassType typeProcedure1

typeProcedure2

public static ClassType typeProcedure2

typeProcedure3

public static ClassType typeProcedure3

typeProcedure4

public static ClassType typeProcedure4

typeProcedureArray

public static ClassType[] typeProcedureArray

typeProcedureN

public static ClassType typeProcedureN

typeRunnable

public static ClassType typeRunnable

typeServlet

public static ClassType typeServlet

typeString

public static ClassType typeString

typeSymbol

public static ClassType typeSymbol

typeType

public static ClassType typeType

typeValues

public static ClassType typeValues

Constructor Details

Compilation

public Compilation(boolean immediate,
                   SourceMessages messages)

Compilation

public Compilation(Language language,
                   SourceMessages messages)

Compilation

public Compilation(Language language,
                   SourceMessages messages,
                   NameLookup lexical)

Compilation

public Compilation(SourceMessages messages)

Method Details

addClass

public void addClass(ClassType new_class)

addMainClass

public void addMainClass(ModuleExp module)

allocLocalField

public Field allocLocalField(Type type,
                             String name)

compileConstant

public void compileConstant(Object value)
Emit code to "evaluate" a compile-time constant. This is the normal external interface.
Parameters:
value - the value to be compiled

compileConstant

public void compileConstant(Object value,
                            Target target)

compileConstantToField

public Field compileConstantToField(Object value)

compileToArchive

public void compileToArchive(ModuleExp mexp,
                             String fname)
            throws java.io.IOException

currentLambda

public LambdaExp currentLambda()

currentModule

public ModuleExp currentModule()
The same as getModule, until we allow nested modules.

currentScope

public ScopeExp currentScope()

demangle2

public static char demangle2(char char1,
                             char char2)
Demangle a three-character mangling starting with '$'. UNFINISHED!

demangleName

public static String demangleName(String name)

demangleName

public static String demangleName(String name,
                                  boolean reversible)

error

public void error(char severity,
                  String message)

error

public void error(char severity,
                  String message,
                  String code,
                  Declaration decl)

error

public void error(char severity,
                  String message,
                  SourceLocator location)

error

public void error(char severity,
                  Declaration decl,
                  String msg1,
                  String msg2)

findForImmediateLiterals

public static Compilation findForImmediateLiterals(int key)

findNamedClass

public ClassType findNamedClass(String name)
Search this Compilation for a ClassType with a given name.
Parameters:
name - the name of the class desired
Returns:
the matching ClassType, or null if none is found

freeLocalField

public void freeLocalField(Field field)

generateApplyMethodsWithContext

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

generateApplyMethodsWithoutContext

public void generateApplyMethodsWithoutContext(LambdaExp lexp)
Generate ModuleBody's apply0...applyN methods. Use the applyMethods vector, which contains methods that implement the (public, readable) methods of the current module.

generateClassName

public String generateClassName(String hint)
Generate an unused class name.
Parameters:
hint - the requested name (or prefix)
Returns:
a unique class name.

generateConstructor

public final void generateConstructor(ClassType clas,
                                      LambdaExp lexp)

generateConstructor

public final void generateConstructor(LambdaExp lexp)

generateMatchMethods

public void generateMatchMethods(LambdaExp lexp)

getBooleanOption

public final boolean getBooleanOption(String key)
Get a named boolean option.

getBooleanOption

public final boolean getBooleanOption(String key,
                                      boolean defaultValue)
Get a named boolean option.

getCode

public final CodeAttr getCode()

getColumnNumber

public final int getColumnNumber()
Return current column number. The "first" column is column 1; unknown is -1.
Specified by:
getColumnNumber in interface SourceLocator

getConstructor

public static final Method getConstructor(ClassType clas,
                                          LambdaExp lexp)

getConstructor

public final Method getConstructor(LambdaExp lexp)

getCurrent

public static Compilation getCurrent()

getFileName

public final String getFileName()
Normally same as getSystemId.
Specified by:
getFileName in interface SourceLocator

getForNameHelper

public Method getForNameHelper()
Generate a method to find a named Class without initializing it. Generate a static helper method "class$" like javac generates for 'CLASS.class', but does not initialize CLASS. Also, we don't bother catching exceptions, since the JVM doesn't require us to. I.e. generates: public static class $(String name) { return Class.forName(name, false, Class.forName(THISCLASSNAME).getClassLoader()); } Note that we want the result to use the same ClassLoader as the caller, which is why we generate a static helper method.

getLanguage

public Language getLanguage()

getLineNumber

public final int getLineNumber()
Return current line number. The "first" line is line 1; unknown is -1.
Specified by:
getLineNumber in interface SourceLocator

getMessages

public SourceMessages getMessages()

getModule

public final ModuleExp getModule()

getModuleType

public final ClassType getModuleType()

getPublicId

public String getPublicId()
Specified by:
getPublicId in interface SourceLocator

getState

public int getState()
Returns a code indicating how far along we are in the parsing/compilation process.

getSystemId

public String getSystemId()
Specified by:
getSystemId in interface SourceLocator

inlineOk

public boolean inlineOk(Expression proc)

inlineOk

public boolean inlineOk(Procedure proc)

isPedantic

public boolean isPedantic()

isStableSourceLocation

public boolean isStableSourceLocation()
True if position is unlikely to change. True for an expression but not an input file.
Specified by:
isStableSourceLocation in interface SourceLocator

isStatic

public boolean isStatic()

isValidJavaName

public static boolean isValidJavaName(String name)

letDone

public LetExp letDone(Expression body)

letEnter

public void letEnter()

letStart

public void letStart()

letVariable

public Declaration letVariable(Object name,
                               Type type,
                               Expression init)

loadCallContext

public final void loadCallContext()
Generate code to push the current CallContext on the JVM stack.

loadClassRef

public void loadClassRef(String className)
Generate code to load a named Class without initializing it.

loadClassRef

public void loadClassRef(ClassType clas)

lookup

public Declaration lookup(Object name,
                          int namespace)

loopBody

public void loopBody(Expression body)

loopCond

public void loopCond(Expression cond)

loopEnter

public void loopEnter()
Done handling loop variables, and pushes them into the lexical scope. Ready to parse the loop condition.

loopRepeat

public Expression loopRepeat()

loopRepeat

public Expression loopRepeat(Expression exp)

loopRepeat

public Expression loopRepeat(Expression[] exps)

loopStart

public void loopStart()
Start a new loop. (We could make this implied by the first loopVaribale call ???)

loopVariable

public Declaration loopVariable(Object name,
                                Type type,
                                Expression init)

mangleName

public static String mangleName(String name)

mangleName

public static String mangleName(String name,
                                boolean reversible)
Convert a string to a safe Java identifier.
Parameters:
reversible - if we should use an invertible mapping.

mangleName

public static String mangleName(String name,
                                int kind)
Convert a string to a safe Java identifier.
Parameters:
kind - -1 - non-reversible; 0: reversible, except that '$' is not mapped; 1: reversible

mangleNameIfNeeded

public static String mangleNameIfNeeded(String name)

mangleURI

public static String mangleURI(String name)
Map a URI to a package/class name. Similar to the JAXB mangling, and that in the Java language spec.

mustCompileHere

public void mustCompileHere()
Note that we have seen a construct that must be compiled, not evaluated. If we are not inside a lambda (which is always compiled), but only inside the outer-most ModuleExp, note that it must be compiled.

outputClass

public void outputClass(String directory)
            throws IOException

parse

public Expression parse(Object input)
This may not make sense, except for Lisp-like languages. For those, 'input' an s-expression from the reader.

pop

public final void pop()

pop

public void pop(ScopeExp scope)

process

public void process(int wantedState)
Parse/walk/compile this module as needed and requested. This method does not process any dependent modules (expect indirectly, such as may be done by a require form).
Parameters:
wantedState - the desired value of getState().

push

public void push(Declaration decl)

push

public void push(ScopeExp scope)

pushNewModule

public ModuleExp pushNewModule(String filename)

pushNewModule

public ModuleExp pushNewModule(Lexer lexer)

pushPendingImport

public void pushPendingImport(ModuleInfo info,
                              ScopeExp defs)

pushScope

public final void pushScope(ScopeExp scope)

registerForImmediateLiterals

public static int registerForImmediateLiterals(Compilation comp)

resolve

public Object resolve(Object name,
                      boolean function)

setColumn

public void setColumn(int column)

setCurrent

public static void setCurrent(Compilation comp)

setCurrentScope

public void setCurrentScope(ScopeExp scope)
Set currentScope(). Also update the nesting object.

setFile

public void setFile(String filename)

setLine

public void setLine(Object location)

setLine

public void setLine(String filename,
                    int line,
                    int column)

setLine

public final void setLine(Expression position)

setLine

public void setLine(int line)

setLocation

public final void setLocation(SourceLocator position)

setMessages

public void setMessages(SourceMessages messages)

setModule

public void setModule(ModuleExp mexp)

setState

public void setState(int state)

setupLiterals

public static void setupLiterals(int key)
Call-back from compiled code to initialize literals in immediate mode. In non-immediate mode (i.e. generating class files) the compiler emits code to "re-construct" literal values. However, in immediate mode that would be wasteful, plus we would get values that are similar (equals) to but not necessarily identical (eq) to the compile-time literal. So we need to pass the literal values to the compiled code, by using reflection to initialize various static fields. This method does that. It is called at the start of the generated static initializer, which helps makes things more consistent between immediate and non-immediate mode.

syntaxError

public Expression syntaxError(String message)
Handle syntax errors (at rewrite time).
Parameters:
message - an error message to print out
Returns:
an ErrorExp

toString

public String toString()

usedClass

public void usedClass(Type type)
Called for classes referenced in bytecode. Since this only does something when immediate, we only care about classes referenced in the bytecode when immediate. It is used to ensure that we can inherit from classes defines when in immediate mode (in Scheme using define-class or similar).

usingCPStyle

public boolean usingCPStyle()

usingTailCalls

public boolean usingTailCalls()

walkModule

public void walkModule(ModuleExp mexp)
Shared processing for both compiling/eval.