Begin Expression Variable State Rule
If Python is in the "begin_expr" state at time t, and the current expression is variable x, and there are no ancestor expressions, then at time t + 1, the state is "end_expr." More formally:
if the following are true:
- expression state at time t = "begin_expr"
- the expression at time t = v
- v is a variable
- parent stack at time t = [ ]
then expression state at time (t + 1) = "end_expr"
If the expression is a variable, then the evaluation is complete in 1 step (look up the variables map). If there is no parent expression to return to, the evaluation is complete.
For example,
if the following are true:
- the expression at time 5 = x
- expression state at time 5 = "begin_expr"
- parent stack at time 5 = [ ]
then expression state at time (5 + 1) = "end_expr"
This simplifies to:
expression state at time 6 = "end_expr"
Try stepping through the simulator to see the "Expression State" change to "end_expr."
Current Line | 1 | Current Tab | 0 | Time | 0 |
Comments
Please log in to add comments