Your job is to write one file Machine.java that contains a class
Machine. Other than the instance variables, constructors, and
get-methods, you will have to write the following methods:
fetchInstruction: this method is not in the interface but you will
find it useful in implementing other methods. The process of fetching
an instruction involves the following steps. First get the word stored
in the memory location addressed by the PC. That word better be an
instruction (not an address or a data); store it in the IR. Increment
the PC.
step: This method takes an
InsVisitor argument: it simply fetches the current instruction, and
asks it to accept the InsVisitor argument.
run: This method steps one instruction at a time until a HaltE
exception is raised.
load: This method accepts a program (represented as an Enumeration
of special words called loadableWords) and loads it in memory. Every
loadableWord consists of an int address and a Word; it should
processed by storing the Word at the memory address. The address of
the first loadableWord should be saved in the PC.