public class Assignment extends GrammarElement
Executing the assignment instruction causes the expression to be evaluated and assigned to the variable, until the assignment instruction executes, the expression isn't evaluated.
Modifier and Type | Field and Description |
---|---|
protected GrammarElement |
myExpression |
protected Variable |
myVariable |
gelementsToValue
Constructor and Description |
---|
Assignment(Variable v,
GrammarElement e)
Construct an Assignment instruction from a variable and an expression,
e.g., X = expression.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
evaluate(Context c)
Evaluate the expression that's part of this instruction and update a
global map/store to record the assignment of the expression to the
variable.
|
java.lang.String |
toString()
Returns a String for this instruction.
|
protected Variable myVariable
protected GrammarElement myExpression
public Assignment(Variable v, GrammarElement e)
e
- expression being assignedv
- variable to which the expression is assignedpublic java.lang.Object evaluate(Context c)
evaluate
in class GrammarElement
c
- is the Context in which the evaluation takes placepublic java.lang.String toString()
toString
in class java.lang.Object