|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gnu.expr.Compilation
public class Compilation
State for a single expression or module. For each top-level thing (expression or file) we compile or evaluate we create a new Compilation.
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)
|
ClassType |
addClass(ModuleExp module)
Compiles a module to a class. |
Field |
allocLocalField(Type type,
java.lang.String name)
|
void |
compile(ModuleExp lexp,
java.lang.String classname,
java.lang.String prefix)
Create a new Compilation environment. |
void |
compileConstant(java.lang.Object value)
Emit code to "evaluate" a compile-time constant. |
void |
compileConstant(java.lang.Object value,
Target target)
|
Field |
compileConstantToField(java.lang.Object value)
|
void |
compileToArchive(ModuleExp mexp,
java.lang.String fname)
|
void |
compileToFiles(ModuleExp mexp,
java.lang.String topname,
java.lang.String directory,
java.lang.String prefix)
|
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 java.lang.String |
demangleName(java.lang.String name)
|
static java.lang.String |
demangleName(java.lang.String name,
boolean reversible)
|
void |
error(char severity,
Declaration decl,
java.lang.String msg1,
java.lang.String msg2)
|
void |
error(char severity,
java.lang.String message)
|
ClassType |
findNamedClass(java.lang.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. |
java.lang.String |
generateClassName(java.lang.String hint)
Generate an unused class name. |
void |
generateConstructor(ClassType clas,
LambdaExp lexp)
|
void |
generateConstructor(LambdaExp lexp)
|
void |
generateMatchMethods(LambdaExp lexp)
|
boolean |
getBooleanOption(java.lang.String key)
Get a named boolean option. |
boolean |
getBooleanOption(java.lang.String key,
boolean defaultValue)
Get a named boolean option. |
CodeAttr |
getCode()
|
int |
getColumn()
|
static Method |
getConstructor(ClassType clas,
LambdaExp lexp)
|
Method |
getConstructor(LambdaExp lexp)
|
static Compilation |
getCurrent()
|
java.lang.String |
getFile()
|
Method |
getForNameHelper()
Generate a method to find a named Class without initializing it. |
Language |
getLanguage()
|
int |
getLine()
|
SourceMessages |
getMessages()
|
ModuleExp |
getModule()
|
ClassType |
getModuleType()
|
boolean |
inlineOk(Expression proc)
|
boolean |
inlineOk(Procedure prcc)
|
boolean |
isStatic()
|
static boolean |
isValidJavaName(java.lang.String name)
|
LetExp |
letDone(Expression body)
|
void |
letEnter()
|
void |
letStart()
|
Declaration |
letVariable(java.lang.Object name,
Type type,
Expression init)
|
void |
loadCallContext()
Generate code to push the current CallContext on the JVM stack. |
void |
loadClassRef(java.lang.String className)
Generate code to load a named Class without initializing it. |
Declaration |
lookup(java.lang.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(java.lang.Object name,
Type type,
Expression init)
|
static java.lang.String |
mangleName(java.lang.String name)
|
static java.lang.String |
mangleName(java.lang.String name,
boolean reversible)
Convert a string to a safe Java identifier. |
static java.lang.String |
mangleNameIfNeeded(java.lang.String name)
|
static java.lang.String |
mangleURI(java.lang.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(java.lang.String directory)
|
Expression |
parse(java.lang.Object input)
This may not make sense, except for Lisp-like languages. |
void |
pop()
|
void |
pop(ScopeExp scope)
|
void |
push(Declaration decl)
|
void |
push(ScopeExp scope)
|
void |
pushScope(ScopeExp scope)
|
java.lang.Object |
resolve(java.lang.Object name,
boolean function)
|
void |
setColumn(int column)
|
static void |
setCurrent(Compilation comp)
|
void |
setCurrentScope(ScopeExp scope)
Set currentScope() . |
void |
setFile(java.lang.String filename)
|
void |
setLine(Expression position)
|
void |
setLine(int line)
|
void |
setLine(java.lang.String filename,
int line,
int column)
|
void |
setMessages(SourceMessages messages)
|
void |
setModule(ModuleExp mexp)
|
Expression |
syntaxError(java.lang.String message)
Handle syntax errors (at rewrite time). |
void |
usedClass(Type type)
Called for classes referenced in bytecode. |
boolean |
usingCPStyle()
|
boolean |
usingTailCalls()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public boolean mustCompile
public ClassType curClass
public ClassType mainClass
public ClassType moduleClass
public LambdaExp curLambda
public ModuleExp mainLambda
public Variable thisDecl
public static boolean fewerClasses
public static boolean debugPrintFinalExpr
public static Options options
public Options currentOptions
public static int defaultCallConvention
public static final int CALL_WITH_UNSPECIFIED
public static final int CALL_WITH_RETURN
public static final int CALL_WITH_CONSUMER
public static final int CALL_WITH_TAILCALLS
public static final int CALL_WITH_CONTINUATIONS
public static int moduleStatic
public boolean immediate
public Method method
public static ClassType typeObject
public static ClassType scmBooleanType
public static ClassType typeString
public static ClassType javaStringType
public static ClassType scmKeywordType
public static ClassType scmSequenceType
public static ClassType javaIntegerType
public static ClassType scmListType
public static ClassType typePair
public static ClassType scmPairType
public static ClassType scmUndefinedType
public static final ArrayType objArrayType
public static ClassType scmNamedType
public static ClassType typeRunnable
public static ClassType typeType
public static ClassType typeObjectType
public static ClassType typeClass
public static ClassType typeClassType
public static ClassType typeProcedure
public static ClassType typeLanguage
public static ClassType typeEnvironment
public static ClassType typeLocation
public static ClassType typeSymbol
public static final Method getSymbolValueMethod
public static final Method getSymbolProcedureMethod
public static final Method getLocationMethod
public static final Method getProcedureBindingMethod
public static final Field trueConstant
public static final Field falseConstant
public static final Type[] int1Args
public static final Type[] string1Arg
public static final Type[] sym1Arg
public static final Method getLocation1EnvironmentMethod
public static final Method getLocation2EnvironmentMethod
public static Method getCurrentEnvironmentMethod
public static Type[] apply0args
public static Type[] apply1args
public static Type[] apply2args
public static Type[] applyNargs
public static Method apply0method
public static Method apply1method
public static Method apply2method
public static Method apply3method
public static Method apply4method
public static Method applyNmethod
public static Method[] applymethods
public static ClassType typeProcedure0
public static ClassType typeProcedure1
public static ClassType typeProcedure2
public static ClassType typeProcedure3
public static ClassType typeProcedure4
public static ClassType typeProcedureN
public static ClassType typeModuleBody
public static ClassType typeModuleWithContext
public static ClassType typeApplet
public static ClassType typeServlet
public static ClassType typeCallContext
public static final ClassType typeConsumer
public static Method getCallContextInstanceMethod
public static ClassType typeValues
public static Field noArgsField
public static Field pcCallContextField
public static ClassType typeMethodProc
public static ClassType typeModuleMethod
public static Field argsCallContextField
public static Field procCallContextField
public static Method applyCpsMethod
public static ClassType[] typeProcedureArray
public static boolean generateMainDefault
public boolean generateMain
public static boolean generateAppletDefault
public boolean generateApplet
public static boolean generateServletDefault
public boolean generateServlet
public static boolean inlineOk
public java.lang.String classPrefix
public static boolean emitSourceDebugExtAttr
protected Language language
public java.util.Stack exprStack
public NameLookup lexical
protected ScopeExp current_scope
protected SourceMessages messages
Constructor Detail |
---|
public Compilation(boolean immediate, SourceMessages messages)
public Compilation(SourceMessages messages)
public Compilation(Language language, SourceMessages messages)
public Compilation(Language language, SourceMessages messages, NameLookup lexical)
Method Detail |
---|
public final boolean getBooleanOption(java.lang.String key, boolean defaultValue)
public final boolean getBooleanOption(java.lang.String key)
public boolean usingCPStyle()
public boolean usingTailCalls()
public final CodeAttr getCode()
public final ClassType getModuleType()
public void compileConstant(java.lang.Object value)
value
- the value to be compiledpublic Field compileConstantToField(java.lang.Object value)
public boolean inlineOk(Expression proc)
public boolean inlineOk(Procedure prcc)
public void compileConstant(java.lang.Object value, Target target)
public ClassType findNamedClass(java.lang.String name)
name
- the name of the class desired
public static java.lang.String mangleURI(java.lang.String name)
public static java.lang.String mangleName(java.lang.String name)
public static java.lang.String mangleNameIfNeeded(java.lang.String name)
public static boolean isValidJavaName(java.lang.String name)
public static java.lang.String mangleName(java.lang.String name, boolean reversible)
reversible
- if we should use an invertible mapping.public static char demangle2(char char1, char char2)
public static java.lang.String demangleName(java.lang.String name)
public static java.lang.String demangleName(java.lang.String name, boolean reversible)
public java.lang.String generateClassName(java.lang.String hint)
hint
- the requested name (or prefix)
public void compile(ModuleExp lexp, java.lang.String classname, java.lang.String prefix)
lexp
- top-level functionclassname
- name of top-level class to generateprefix
- prefix to pre-pend to the names of other (non-top) classespublic void compileToFiles(ModuleExp mexp, java.lang.String topname, java.lang.String directory, java.lang.String prefix) throws java.io.IOException
java.io.IOException
public void outputClass(java.lang.String directory) throws java.io.IOException
java.io.IOException
public void compileToArchive(ModuleExp mexp, java.lang.String fname) throws java.io.IOException
java.io.IOException
public void addClass(ClassType new_class)
public final Method getConstructor(LambdaExp lexp)
public static final Method getConstructor(ClassType clas, LambdaExp lexp)
public final void generateConstructor(LambdaExp lexp)
public final void generateConstructor(ClassType clas, LambdaExp lexp)
public void generateMatchMethods(LambdaExp lexp)
public void generateApplyMethodsWithContext(LambdaExp lexp)
public void generateApplyMethodsWithoutContext(LambdaExp lexp)
public final ClassType addClass(ModuleExp module)
public Field allocLocalField(Type type, java.lang.String name)
public final void loadCallContext()
public void freeLocalField(Field field)
public Expression parse(java.lang.Object input)
public Language getLanguage()
public LambdaExp currentLambda()
public final ModuleExp getModule()
public void setModule(ModuleExp mexp)
public boolean isStatic()
public ModuleExp currentModule()
public void mustCompileHere()
public ScopeExp currentScope()
public void setCurrentScope(ScopeExp scope)
currentScope()
.
Also update the nesting
object.
public void push(ScopeExp scope)
public final void pushScope(ScopeExp scope)
public void pop(ScopeExp scope)
public final void pop()
public void push(Declaration decl)
public Declaration lookup(java.lang.Object name, int namespace)
public void usedClass(Type type)
public SourceMessages getMessages()
public void setMessages(SourceMessages messages)
public void error(char severity, java.lang.String message)
public void error(char severity, Declaration decl, java.lang.String msg1, java.lang.String msg2)
public Expression syntaxError(java.lang.String message)
message
- an error message to print out
public final java.lang.String getFile()
public final int getLine()
public final int getColumn()
public void setFile(java.lang.String filename)
public void setLine(int line)
public void setColumn(int column)
public final void setLine(Expression position)
public void setLine(java.lang.String filename, int line, int column)
public void letStart()
public Declaration letVariable(java.lang.Object name, Type type, Expression init)
public void letEnter()
public LetExp letDone(Expression body)
public void loopStart()
public Declaration loopVariable(java.lang.Object name, Type type, Expression init)
public void loopEnter()
public void loopCond(Expression cond)
public void loopBody(Expression body)
public Expression loopRepeat(Expression[] exps)
public Expression loopRepeat()
public Expression loopRepeat(Expression exp)
public void loadClassRef(java.lang.String className)
public Method getForNameHelper()
public java.lang.Object resolve(java.lang.Object name, boolean function)
public static Compilation getCurrent()
public static void setCurrent(Compilation comp)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |