CS502 PROJECT 1: IMPLEMENTING SWITCH STATEMENTS Due: 11/16/2009, 11:59pm Your task is to add support for switch statements to the MiniJava compiler. Details can be found in the Java Language Specification, available at: http://java.sun.com/docs/books/jls To resolve questions about Java syntax and semantics, it is often useful to compile simple test cases using the standard Java compiler (javac). Remember, every MiniJava program is a legal Java program, so you can always see what the real Java compiler (javac) does for a particular MiniJava program. There are several alternatives to implementing switch statements, and you will be graded according to the sophistication of your solution. The simplest approach is to evaluate the switch expression, and then use a cascade of conditionals to select the corresponding case value (this works well for a small set of case values). Another approach is to use binary search to select the case branch target from a static table ordered by case value (this works well for a sparse set of case values). A third approach is to use a static hash table to map case values to branch targets. You will need to change files implementing several different phases of the MiniJava compiler, including: Parse/MiniJava.jj : scanning/parsing Absyn/MiniJava.jj : abstract syntax tree node classes Semant/MiniJava.java : semantic checking (e.g., types) Translate/MiniJava.java : intermediate code translation Mips/Codegen.java : MIPS object code generation PPC/Codegen.java : PowerPC object code generation Each phase produces different output, which can be viewed on the standard output by invoking the commands: java Parse.MiniJava java Semant.MiniJava java Translate.MiniJava java Main.MiniJava on a MiniJava input file, for each phase, respectively. The last of these runs the compiler to completion, generating an output assembly-code file. You should work on the parser first, then the type-checker, then translation to intermediate code, and finally assembly code. WHAT TO TURN IN You should turn in your project solution using the command: turnin . from your project working directory.