|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elang.evm.ParseNode | +--org.erights.e.elang.evm.ENode | +--org.erights.e.elang.evm.EExpr
Untamed: Those ParseNodes that--after expansion--define the kernel expressions evaluated by the E Virtual Machine.
Field Summary |
Fields inherited from class org.erights.e.elang.evm.ENode |
|
Fields inherited from class org.erights.e.elang.evm.ParseNode |
NUM_PR, PR_ASSIGN, PR_CALL, PR_COMP, PR_EEXPR, PR_LISTPATT, PR_ORDER, PR_PATTERN, PR_PRIM, PR_START |
Constructor Summary | |
protected |
EExpr(SourceSpan optSpan)
|
Method Summary | |
void |
__printOn(TextWriter out)
Enabled: @see #subPrintOn |
(package private) static void |
appendAllTo(FlexList accum,
EExpr[] all)
Recursively append all the supplied nodes to accum. |
(package private) void |
appendTo(FlexList accum)
Append the sequence of operations representated by this node to the argument. |
static Object |
eval(EExpr self,
Scope scope,
int maxLocals)
Enabled: To be invoked only on a Transformed-E expression to do the actual evaluation. |
Object |
eval(Scope scope)
Enabled: Used to evaluate this expression to a value in scope. |
(package private) boolean |
evalBool(EvalContext ctx)
Like subEval, but returns the result coerced to a boolean. |
void |
printAsBlockOn(TextWriter out)
Enabled: |
protected abstract Object |
subEval(EvalContext ctx,
boolean forValue)
The recursive part that does the work |
EExpr |
substitute(ConstList args)
Enabled: |
static Object[] |
transform(EExpr self,
Scope scope)
Enabled: Transforms from Expanded-E or Kernel-E to the internal Transformed-E. |
Methods inherited from class org.erights.e.elang.evm.ENode |
cleanCopy, computeStaticScope, copy, getOptPatternMap, getOptScopeMap, getPatternMap, getScopeMap, qbuild, setPatternMap, setScopeMap, staticScope, synEnv, welcome |
Methods inherited from class org.erights.e.elang.evm.ParseNode |
asText, getOptSpan, lnPrintOn, lnPrintOn, matchBind, matchBind, matchBind, matchBind, printListOn, subPrintOn, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected EExpr(SourceSpan optSpan)
Method Detail |
public void __printOn(TextWriter out) throws IOException
__printOn
in interface EPrintable
__printOn
in class ParseNode
IOException
ParseNode.subPrintOn(org.erights.e.elib.oldeio.TextWriter, int)
public EExpr substitute(ConstList args)
public static Object[] transform(EExpr self, Scope scope)
The transform method is factored out from eval so that the interpreter loop can print the transformed expression for debugging purposes.
XXX This should be changed to only take a scopeMap as argument instead, so that the [Expanded-E, ScopeMap] => Transformed-E mapping can be memoized. Once we compile Transformed-E to JVM bytecodes, this will allow us to cache the class files and classes as well.
public static Object eval(EExpr self, Scope scope, int maxLocals)
This is the rest of eval/1
after factoring out
transform/2
, and is likewise public
only for debugging purposes.
XXX We need to enforce that this is only invoked on a Transformed-E expression. The Transformed-E EExpr should probably remember the number of locals it needs, so we don't have to worry about a bad value being passed in.
public Object eval(Scope scope)
protected abstract Object subEval(EvalContext ctx, boolean forValue)
boolean evalBool(EvalContext ctx)
public void printAsBlockOn(TextWriter out) throws IOException
IOException
void appendTo(FlexList accum)
accum
- static void appendAllTo(FlexList accum, EExpr[] all)
accum
- the List to accumulate the results into.all
- the EExprs to accumulate.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |