Class InterpretContext
- java.lang.Object
-
- com.googlecode.aviator.code.interpreter.InterpretContext
-
public class InterpretContext extends java.lang.Object
Eval IR context.
-
-
Field Summary
Fields Modifier and Type Field Description private Env
env
private InterpretExpression
expression
private IR[]
instruments
private java.util.ArrayDeque<AviatorObject>
operands
private IR
pc
private int
pcIndex
private boolean
reachEnd
private boolean
trace
-
Constructor Summary
Constructors Constructor Description InterpretContext(InterpretExpression exp, java.util.List<IR> instruments, Env env)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearStack()
java.lang.String
descOperandsStack()
void
dispatch()
Move pc to next and execute it.void
dispatch(boolean next)
dispatch next IR execution.Env
getEnv()
InterpretExpression
getExpression()
java.util.ArrayDeque<AviatorObject>
getOperands()
IR
getPc()
boolean
isReachEnd()
void
jumpTo(int tpc)
AviatorObject
loadConstant(Token<?> token)
AviatorJavaType
loadVar(VariableMeta v)
boolean
next()
AviatorObject
peek()
AviatorObject
pop()
void
push(AviatorObject arg)
-
-
-
Field Detail
-
operands
private final java.util.ArrayDeque<AviatorObject> operands
-
pc
private IR pc
-
pcIndex
private int pcIndex
-
instruments
private IR[] instruments
-
env
private final Env env
-
expression
private final InterpretExpression expression
-
reachEnd
private boolean reachEnd
-
trace
private final boolean trace
-
-
Constructor Detail
-
InterpretContext
public InterpretContext(InterpretExpression exp, java.util.List<IR> instruments, Env env)
-
-
Method Detail
-
loadVar
public AviatorJavaType loadVar(VariableMeta v)
-
loadConstant
public AviatorObject loadConstant(Token<?> token)
-
isReachEnd
public boolean isReachEnd()
-
getOperands
public java.util.ArrayDeque<AviatorObject> getOperands()
-
clearStack
public void clearStack()
-
jumpTo
public void jumpTo(int tpc)
-
getExpression
public InterpretExpression getExpression()
-
getEnv
public Env getEnv()
-
next
public boolean next()
-
getPc
public IR getPc()
-
push
public void push(AviatorObject arg)
-
peek
public AviatorObject peek()
-
pop
public AviatorObject pop()
-
descOperandsStack
public java.lang.String descOperandsStack()
-
dispatch
public void dispatch()
Move pc to next and execute it.
-
dispatch
public void dispatch(boolean next)
dispatch next IR execution.- Parameters:
whether
- to move pc next.
-
-