gnu.expr
Class Compilation
java.lang.Object
|
+--gnu.expr.Compilation
- public class Compilation
- extends java.lang.Object
|
Constructor Summary |
Compilation(LambdaExp lexp,
java.lang.String classname,
java.lang.String prefix,
boolean immediate)
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
curClass
public ClassType curClass
mainClass
public ClassType mainClass
curLambda
public LambdaExp curLambda
thisDecl
public Variable thisDecl
fewerClasses
public static boolean fewerClasses
- If true, minimize the number of classes generated.
Do this even if it makes things a little slower.
usingCPStyle
public static boolean usingCPStyle
usingTailCalls
public static boolean usingTailCalls
method
public Method method
- The current method.
typeObject
public static ClassType typeObject
scmBooleanType
public static ClassType scmBooleanType
typeString
public static ClassType typeString
javaStringType
public static ClassType javaStringType
scmSymbolType
public static ClassType scmSymbolType
scmKeywordType
public static ClassType scmKeywordType
scmSequenceType
public static ClassType scmSequenceType
javaIntegerType
public static ClassType javaIntegerType
scmListType
public static ClassType scmListType
typePair
public static ClassType typePair
scmPairType
public static ClassType scmPairType
scmUndefinedType
public static ClassType scmUndefinedType
objArrayType
public static final ArrayType objArrayType
symbolArrayType
public static final ArrayType symbolArrayType
scmNamedType
public static ClassType scmNamedType
typeProcedure
public static ClassType typeProcedure
typeInterpreter
public static ClassType typeInterpreter
typeMacro
public static ClassType typeMacro
typeEnvironment
public static ClassType typeEnvironment
typeLocation
public static ClassType typeLocation
typeBinding
public static ClassType typeBinding
typeBinding2
public static ClassType typeBinding2
getLocationMethod
public static final Method getLocationMethod
getProcedureBindingMethod
public static final Method getProcedureBindingMethod
trueConstant
public static final Field trueConstant
falseConstant
public static final Field falseConstant
int1Args
public static final Type[] int1Args
string1Arg
public static final Type[] string1Arg
sym1Arg
public static final Type[] sym1Arg
getBindingEnvironmentMethod
public static final Method getBindingEnvironmentMethod
getBinding2Method
public static final Method getBinding2Method
getCurrentEnvironmentMethod
public static Method getCurrentEnvironmentMethod
apply0args
public static Type[] apply0args
apply1args
public static Type[] apply1args
apply2args
public static Type[] apply2args
applyNargs
public static Type[] applyNargs
makeNullPairMethod
public static final Method makeNullPairMethod
makePairMethod
public static Method makePairMethod
apply0method
public static Method apply0method
apply1method
public static Method apply1method
apply2method
public static Method apply2method
apply3method
public static Method apply3method
apply4method
public static Method apply4method
applyNmethod
public static Method applyNmethod
applymethods
public static Method[] applymethods
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
typeProcedureN
public static ClassType typeProcedureN
typeModuleBody
public static ClassType typeModuleBody
typeApplet
public static ClassType typeApplet
typeModuleMethod
public static ClassType typeModuleMethod
typeApplyMethodProc
public static ClassType typeApplyMethodProc
typeApplyMethodContainer
public static ClassType typeApplyMethodContainer
typeCallStack
public static ClassType typeCallStack
popCallStackMethod
public static Method popCallStackMethod
typeValues
public static ClassType typeValues
noArgsField
public static Field noArgsField
valueCallStackField
public static Field valueCallStackField
pcCallStackField
public static Field pcCallStackField
typeCpsProcedure
public static ClassType typeCpsProcedure
typeCallFrame
public static ClassType typeCallFrame
numArgsCallFrameField
public static Field numArgsCallFrameField
argsCallStackField
public static Field argsCallStackField
procCallStackField
public static Field procCallStackField
callerCallFrameField
public static Field callerCallFrameField
saved_pcCallFrameField
public static Field saved_pcCallFrameField
applyCpsMethod
public static Method applyCpsMethod
typeProcedureArray
public static ClassType[] typeProcedureArray
generateMainDefault
public static boolean generateMainDefault
generateMain
public boolean generateMain
- True if we should generate a main(String[]) method.
generateAppletDefault
public static boolean generateAppletDefault
generateApplet
public boolean generateApplet
- True if we should generate an Applet.
classPrefix
public java.lang.String classPrefix
- If non-null: a prefix for generateClassName to prepend to names.
Compilation
public Compilation(LambdaExp lexp,
java.lang.String classname,
java.lang.String prefix,
boolean immediate)
getCode
public final CodeAttr getCode()
getMethodProcType
public final ClassType getMethodProcType()
getModuleSuperType
public final ClassType getModuleSuperType()
getInterpreter
public Interpreter getInterpreter()
findLiteral
public Literal findLiteral(java.lang.Object value)
emitLiteral
public void emitLiteral(java.lang.Object value)
- Emit code to push a value.
Only used when compiling to a file, and for internal use.
Must previously have called findLiteral (to detect cycles).
compileConstant
public void compileConstant(java.lang.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(java.lang.Object value,
Target target)
findNamedClass
public ClassType findNamedClass(java.lang.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
mangleName
public static java.lang.String mangleName(java.lang.String name)
- Convert a string to a safe Java identifier.
This is not invertible (since '_' is passed unchanged).
This should be fixed.
generateClassName
public java.lang.String generateClassName(java.lang.String hint)
- Generate an unused class name.
- Parameters:
hint - the requested name (or prefix)- Returns:
- a unique class name.
addClass
public void addClass(ClassType new_class)
generateConstructor
public final Method generateConstructor(ClassType clas,
LambdaExp lexp)
generateApplyMethods
public void generateApplyMethods()
- Generate ModuleBody's apply0 .. applyN methods.
Use the applyMethods vector, which contains methods that implement
the (public, readable) methods of the current module.
addClass
public final ClassType addClass(LambdaExp lexp)
- Compiles a function to a class.
usingCPStyle
public static boolean usingCPStyle()
usingTailCalls
public static boolean usingTailCalls()
allocLocalField
public Field allocLocalField(Type type,
java.lang.String name)
freeLocalField
public void freeLocalField(Field field)
getBindingField
public Field getBindingField(java.lang.String name)
- Allocate a static Binding field used to access globals bindings.
error
public void error(char severity,
java.lang.String message)
error
public void error(char severity,
java.lang.String filename,
int line,
int column,
java.lang.String message)
error
public void error(SourceError err)