Evaluate Constant Argument State Property

If Python is in the "begin_expr" state at time t, and the current expression is constant c, and there is a parent expression, then the state is updated to "return." More formally:

if the following are true:
  • expression state at time t = "begin_expr"
  • the expression at time t = c
  • c is constant
  • parent stack at time t = [ x, y ]

then expression state at time (t + 1) = "return"

When there is a parent expression and potentially other arguments remaining to evaluate, the state is updated to "return." If there isn't a parent expression, the state would change to "end_expr" and expression evaluation ends.

For example, if the following are true:

  • the expression at time 4 = 5
  • expression state at time 4 = "begin_expr"
  • parent stack at time 4 = [ __add__(5, 2), [ ] ]

then expression state at time (4 + 1) = "return"

Try stepping through the simulator to see the Expression state change to "return."

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments