Breaking Line Property
If the "break" state is "breaking" at time t, and LW Python is currently inside an "if/elif/else" block, then at time t + 1, the line number stays the same. More formally,
if the following are true:
- the line at time t = i
- the tab at time t = j
- "break" state at t = "breaking"
- value at (j - 1) in map (Control Map at time t) = control_value
- control_value describes a loop = False
then the line at time (t + 1) = i
How do we know whether Python is currently inside an "if/elif/else" block? If the "Control" map has an entry at current tab - 1, and the value has an "if" in it, then we know that there was an "if/elif/else" statement at current tab - 1.
For example,
if the following are true:
- the line at time 82 = 6
- the tab at time 82 = 2
- "break" state at 82 = "breaking"
- value at (2 - 1) in map (Control Map at time 82) = pair ("if", True)
then the line at time (82 + 1) = 6
Try stepping through the simulator to see the "Current Line" remain at 6 while LW Python is breaking.
Code Editor
LW Python State
Current Line | 1 | Current Tab | 0 | Time | 0 |
LW Python Simulator
Comments
Please log in to add comments