Lab: BugsWorld Virtual Machine ByteCode Interpreter
Objective
In this lab you familiarize yourself with the BugsWorld virtual machine (VM) instruction set and behavior by writing and testing an interpreter of the VM byte code programs.
Setup
To get started, import the project for this lab,
BugsWorldVMInterpreter, from the BugsWorldVMInterpreter.zip file
available at this link. If you don't
remember how to do this, see the Setup
instructions
in an earlier lab.
Method
- First carefully look through the file
BugsWorldVMInterpreter.javain thesrcfolder and make sure you understand what each method does, including themainmethod. Complete the body of the static methodnextPrimitiveInstructionAddressby pasting the code you wrote for the homework into the skeleton provided. - Open the file
BugsWorldVMInterpreterTest.javain thetestfolder and review the test cases provided to see how they are set up and how they attempt to test your implementation of the interpreter. Run the JUnit test fixture and carefully review any test cases that fail. If that is not enough information to help you find the bug(s), you can also run the main program inBugsWorldVMInterpreterand interactively execute a compiled BL program. In thedatafolder you will find one sample BL programTestProgram.bland its compiled versionTestProgram.bothat you can use as input to the main program. Fix all the bugs and make sure your interpreter passes all the test cases to complete this lab.