Let us consider the following sample program.
This program would produce the following trace:
A | B | C | D | Explanation |
|
1 | line# | x | y |
|
|
2 | pre | ? | ? | We do not need to assume any value. |
|
3 | 5 | 3 | We start execution here because this is the first line outside of the definition of a subrotuine. Initialize y. |
||
4 | 6 | retline# | The invocation first allocates a new column, in this case, column D. |
||
5 | post | When the subroutine is finished, we continue execution at “post”, which means the execution of the entire program is done. |
|||
6 | 2 | 3 | Start with the first action line of the subroutine being invoked. |
||
7 | 3 | retline# | First, copy the line number of the right-most “retline#” column to the “line#” column of the next row so you remember where to continue execution. Then deallocate the “retline#” column. |
||
8 | post | Continue execution where the “retline#” column (now deallocated) told us to. |
|||