Hi John: I have thougt about the project and I plan something that will look familiar to you! There are some typos which I have corrected in the testing subdirectory. Please can you extend the code in the testing directory so that it prints the desired output. Should they translate the traversal graph into an intermediate representation from which it is easy to generate the code? Or is the traversal graph a good intermediate notation? -- Karl ============== Project The goal of the project is to perform a software development task from design through implementation. The task is to write a translator from a language L1 to a language L2. The language L1 consists of all of Java plus a traversal language T. The output language consists of a small subset of AspectJ. The purpose of the translation is to translate high-level traversal specifications to Java traversal methods, similar to the ones you wrote in homework 2. Example input: Java: class Basket { Fruit f; Pencil p; } class Fruit { Weight w;} class Orange extends Fruit { Color c; } class Pencil {} class Color { String s; } class Weight{ int i; } class Main { public static void main() {} } T: aspect Traversals { declare traversal t1 = Basket to *; declare traversal t2 = Basket to Weight; } output: aspect TraveralsImplementation { void Basket.t1(){ if (f != null) t1_f(); if (p != null) t1_p();} void Basket.t1_f(){if f.t1();} void Basket.t1_p(){if p.t1();} void Fruit.t1(){t1_w();} void Fruit.t1_w(){w.t1();} void Orange.t1(){t1_c(); super.t1();} void Orange.t1(){c.t1();} void Pencil.t1(){}; void Color.t1(){}; void Weight.t1(){}; void Basket.t2(){t2_f();} void Basket.t2_f(){f.t2();} void Fruit.t2(){t2_w();} void Fruit.t2_w(){w.t2();} void Orange.t2(){super.t2();} void Weight.t2(){}; } To test your output, you should compile it with the AspectJ compiler ajc. See URL. aspect TraversalsTest { pointcut mainCall() : call(public static void main()); before mainCall() { // create Basket b b.t1(); b.t2(); } pointcut nodeTraversals(Object o): call(void t1()) && target(o); pointcut edgeTraversals(Source s, Target t): within(*.t1_*()) && call(void t1()) && this(s) && target(t); before nodeTraversals(o) { System.out.println("traversing node " + o); } before edgeTraversals((Source s, Target t) { System.out.println( "traversing edge: source= " + o + " target= " + t); System.out.println(thisJoinPoint); } // same but replace t1 by t2 } The project consists of the following steps: 1. Produce the class graph cg from the Java program. 2. For cg and a fixed traversal strategy produce the traversal graph. 3. Generate the traversal code from a fixed traversal graph using the interface of the AP Library available in DJ. 4. Test the generated traversal code manually. 5. Automate 2./3./4.: Read in traversal graphs from file Traversals.java and translate them into a file that, when compiled by AspectJ and executed, will produce the file TraversalsImplementation.java (containing the traversal code) and TraversalsTest.java (containing the test code). We will develop the project in phases: Traversal specifications: T1. from A to * T2. from A to B T3. from A bypassing B to C Class graphs: C1. Only construction classes and edges. C2. Add alternation classes and edges. C3. Add collections. Due dates: 1. within 2 days. 2. within 4 days. 3./4. T1/C1 within 9 days. 5. T1/C1 within 12 days.