Interface EvaluationOrder
-
- All Known Implementing Classes:
LeftToRightEvaluation
,RightToLeftEvaluation
public interface EvaluationOrder
The order of evaluation of the sub-expressions of anNaryExpression
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <A extends AbstractState<A>>
AnalysisState<A>bwdEvaluate(Expression[] subExpressions, AnalysisState<A> entryState, InterproceduralAnalysis<A> interprocedural, StatementStore<A> expressions, ExpressionSet[] computed)
Evaluates the given sub-expressions according to this order, but in reverse order and using the backward semantics.<A extends AbstractState<A>>
AnalysisState<A>evaluate(Expression[] subExpressions, AnalysisState<A> entryState, InterproceduralAnalysis<A> interprocedural, StatementStore<A> expressions, ExpressionSet[] computed)
Evaluates the given sub-expressions according to this order.int
first(int len)
Yields the index of the first sub-expression that has to be evaluated.int
last(int len)
Yields the index of the last sub-expression that has to be evaluated.int
next(int pos, int len)
Assuming thatpos
is the index of a sub-expression, yields the index of the sub-expression that has to be evaluated after the given one.int
previous(int pos, int len)
Assuming thatpos
is the index of a sub-expression, yields the index of the sub-expression that has to be evaluated before the given one.
-
-
-
Method Detail
-
previous
int previous(int pos, int len)
Assuming thatpos
is the index of a sub-expression, yields the index of the sub-expression that has to be evaluated before the given one.- Parameters:
pos
- the index of a sub-expressionlen
- the total number of sub-expressions- Returns:
- the previous index (a negative value means that there is no
previous sub-expression, that is,
pos
is the first that needs to be evaluated)
-
next
int next(int pos, int len)
Assuming thatpos
is the index of a sub-expression, yields the index of the sub-expression that has to be evaluated after the given one.- Parameters:
pos
- the index of a sub-expressionlen
- the total number of sub-expressions- Returns:
- the next index (a negative value means that there is no next
sub-expression, that is,
pos
is the last that needs to be evaluated)
-
first
int first(int len)
Yields the index of the first sub-expression that has to be evaluated.- Parameters:
len
- the total number of sub-expressions- Returns:
- the index of the first expression to evaluate
-
last
int last(int len)
Yields the index of the last sub-expression that has to be evaluated.- Parameters:
len
- the total number of sub-expressions- Returns:
- the index of the last expression to evaluate
-
evaluate
<A extends AbstractState<A>> AnalysisState<A> evaluate(Expression[] subExpressions, AnalysisState<A> entryState, InterproceduralAnalysis<A> interprocedural, StatementStore<A> expressions, ExpressionSet[] computed) throws SemanticException
Evaluates the given sub-expressions according to this order. This method will fillcomputed
andsubStates
such thatsubStates[i] = subExpressions[i].semantics(); computed[i] = subStates[i].computedExpressions
, while also setting the runtime types for the expressions left on the stack.- Type Parameters:
A
- the type ofAbstractState
- Parameters:
subExpressions
- the sub-expressions to evaluateentryState
- the state to use as starting point for the evaluationinterprocedural
- the interprocedural analysis of the program to analyzeexpressions
- the cache where analysis states of intermediate expressions must be stored (this method is responsible for storing the results of the sub-expressions)computed
- an array containing, for each sub-expression, the symbolic expressions produced by its evaluation- Returns:
- the last computed state, where the source expression can be evaluated
- Throws:
SemanticException
- if something goes wrong during the evaluation
-
bwdEvaluate
<A extends AbstractState<A>> AnalysisState<A> bwdEvaluate(Expression[] subExpressions, AnalysisState<A> entryState, InterproceduralAnalysis<A> interprocedural, StatementStore<A> expressions, ExpressionSet[] computed) throws SemanticException
Evaluates the given sub-expressions according to this order, but in reverse order and using the backward semantics.- Type Parameters:
A
- the type ofAbstractState
- Parameters:
subExpressions
- the sub-expressions to evaluateentryState
- the state to use as starting point for the evaluationinterprocedural
- the interprocedural analysis of the program to analyzeexpressions
- the cache where analysis states of intermediate expressions must be stored (this method is responsible for storing the results of the sub-expressions)computed
- an array containing, for each sub-expression, the symbolic expressions produced by its evaluation- Returns:
- the last computed state, where the source expression can be evaluated
- Throws:
SemanticException
- if something goes wrong during the evaluation
-
-