Question: I'm using c++ Our goal is to implement an emulator for a register machine. Recall that a register machine has an unlimited number of registers

I'm using c++
Our goal is to implement an emulator for a register machine. Recall that a register machine has an unlimited number of registers and the following three instructions. HALT, stops the machine INC r j, increments the contents of register r, and moves to instruction number j. DEB r ij, If contents of register ris > 0 then decrement the register and move to instruction i, else move to instruction j. Consider the ADD program. ADD 1 2, adds the contents of register 1 to contents of register 2. 1. DEB 1 2 3 2. INC 2 1 3. HALT State of such a program can be described by the contents of the registers. Execution of ADD 4 1 will result in the following states Register 1, Register 2 1 Q1. Write a program that will take as input a program for a register machine and execute it. For each execution step display the state of the register program. Our goal is to implement an emulator for a register machine. Recall that a register machine has an unlimited number of registers and the following three instructions. HALT, stops the machine INC r j, increments the contents of register r, and moves to instruction number j. DEB r ij, If contents of register ris > 0 then decrement the register and move to instruction i, else move to instruction j. Consider the ADD program. ADD 1 2, adds the contents of register 1 to contents of register 2. 1. DEB 1 2 3 2. INC 2 1 3. HALT State of such a program can be described by the contents of the registers. Execution of ADD 4 1 will result in the following states Register 1, Register 2 1 Q1. Write a program that will take as input a program for a register machine and execute it. For each execution step display the state of the register program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
