Begin Expression Variable Rule

If Python is in the "begin_expr" state, at time t, and the current expression is variable x, then the "return value" is set to the value of x in the variables map.

if the following are true:
  • expression state at time t = "begin_expr"
  • the expression at time t = v
  • v is a variable

then Return Value at time (t + 1) = value at x in map (Variables Map at time t)

Whenever an expression has been evaluated, the result is stored in the "return value." For example, if the following are true:
  • the expression at time 4 = x
  • expression state at time 4 = "begin_expr"
  • Variables Map at time 4 = [ entry x: 7, [ ] ]

then Return Value at time (4 + 1) = value at x in map (Variables Map at time 4)

We know that:

value at x in map [ entry x: 7, [ ] ] = 7

Therefore, we conclude that:

Return Value at time 5 = 7

See here for the full proof.

Try stepping through the simulator to see the "Return Value" set to the value of "x."

Code Editor
LW Python State
Current Line1Current Tab0Time0
LW Python Simulator

Comments

Please log in to add comments