Iterate Arguments Finished Rule

When the state is "iterate_args" and the "Arguments" stack is empty, then all the arguments have been evaluated. Now LW Python is ready to evaluate the parent expression. To start, the first element of the parent stack is popped and set to "Expression."

if the following are true:
  • expression state at time t = "iterate_args"
  • arguments stack at time t = [ [ ], z ]
  • parent stack at time t = [ x, y ]

then the expression at time (t + 1) = x

For example, if the following are true:

  • expression state at time 9 = "iterate_args"
  • arguments stack at time 9 = [ [ ], [ ] ]
  • parent stack at time 9 = [ __add__(5, 2), [ ] ]

then the expression at time (9 + 1) = __add__(5, 2)

Try stepping through the simulator to see the "Expression" change back to the parent expression.

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments