The callstack can be implemented as a contiguous array of frame
records:
By default, the callstack can be initialized as an empty array.
Example implementation : - Data type: Array of tuples ‘[(PC, SP)]’ - PC (Program Counter): Return address (next instruction after CALL) - SP (Stack Pointer): Stack state at call time
| Frame | PC | SP | Description |
|---|---|---|---|
| 0 | 0 | 0 | Entry point |
| 1 | 12 | 16 | First function call |
| 2 | 57 | 24 | Current function locale start |