CS451/651 Compilers
Bill Campbell
Spring 2008
Programming Exercise 5: Analysis and Code Generation II

Your job here is to implement analysis and code generation for the following constructs, which you parsed in programming exercise 3. You will ant to see Chapter 7 (and other chapters) of the JVM Spec: http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html.

1.     Double literals. This will affect most numeric operations and casts.  Notice there are no implicit conversions.

2.     All additional operators, including logicals.

3.     Conditional expressions.

4.     The switch statement.

5.     Variable arity methods.

It’s probably best to write a set of test programs first. Then you can compile them with javac to see what it generates for code.  And you have some measure as to when you are done.   (Welcome to extreme programming.)

Hand in hard copy of your program, your test program and their results, and your narrative no later than 5:30, Monday, May 12.  And, as usual, put your tree in p5/ of your course directory.

Your narrative will be very important in this assignment, since there are things left unsaid. This assignment makes use of many classes, I strongly suggest that you start out on this assignment immediately; there is lots of programming to do, there is lots of testing to do, and probably there will be lots of repairing to do. And, of course there is lots of writing to do. Have fun!

grade sheet