<<< Building Your Own Stack Machine | Index | Stack Machine Memory >>> |
Each command needs to print detailed information about its particular execution step. For example, the source program
push 123 push 456 add add hlt start
should generate the following (or similar) output as a result of the execution:
1. PUSH 123 2. PUSH 456 3. ADD 456 + 123 = 579 4. ADD 579 + *** ERROR: THE STACK IS EMPTY
The first column displays an imaginary program counter. This can be either a sequential number or an actual address of the command in memory.
<<< Building Your Own Stack Machine | Index | Stack Machine Memory >>> |