From Stack to Register Machines

What is a register machine?

If stack depth is less than the number of general purpose registers, treat registers as stack.

If SP is a stack pointer as maintained by the compiler, then we essentially emit instructions that correspond to code for VM for Expressions

  • each instruction encodes a fixed value of SP, fixed register