Convert some simple Java programs into Decaf Java-In-Scheme. For example, consider the programs in java-syntax.scm: ;; class phw { ;; public static void main() { ;; System.out.println("Hello, world"); ;; } ;; } (CLASS () phw (METHOD (public static) void main () (call (DOT System out println) "Hello, world"))) ;; class phw { ;; public static void main() { ;; System.out.println("Hello, world"); ;; } ;; } (CLASS phw (METHOD (public static) void main () (call (DOT System out println) "Hello, world"))) Go over some of the interesting bits of code from java-eval and java-support. The idea is to let them get a bit used to the data structures described in lecture (objects and classes; frames and lists of bindings). Some nice bits of code to consider are: COERCE which takes a value and a CLASS (type) and tries to convert the value to the given type by walking back up the object's class chain searching for the desired type. If it succeeds, it returns the corresponding superobject of the original value. FIND-BINDING which takes a name (called VAR, unfortunately), a Decaf Java-in-Scheme environment, and a NEXT procedure. It searches for a binding of the variable as a FIELD (not a method) and returns the value of the variable. Most of the interesting stuff here is how it deals with the base frames (GLOBAL, OBJECT, CLASS). Some of the Java evaluation procedures are simple and you can show the use of flow-of-control (or CPS style requires odd coding styles): J-EVAL-CALL is the standard procedure call and is very similar to Scheme if you add COERCE and special handling for the operator (method lookup). Do NOT try to go over the method lookup code in class unless you are really prepared -- it's a major subject on the problem set but they are asked to look at only a very small part because the code is very complicated. But the code in J-EVAL-CALL is very similar to Scheme, so it's nice to compare. Some things to notice are the need to create a label for RETURN, the creation of a new base environment (using BASIC-ENVIRONMENT) that will either be a CLASS (for static methods) or an OBJECT (for dynamic methods); the coercion of the arguments and return value; and the creation of a PARAMETERS frame to bind the arguments. J-EVAL-INSTANCEOF if you want to talk about dynamic typing in Java. It has to use the dynamic type of the object to see if it can be "downward" cast. J-EVAL-GLOBAL shows how default values are supplied if a variable is declared without specifying a value. The perrenial favorite J-EVAL-IF shows how to rewrite IF in continuation passing style, which is good if you've never seen it before. Your students certainly won't have seen it yet. Going over J-EVAL-WHILE, which is on the problem set as an example (they have to write DO) is a nice idea.