Fall 1996 project. Name : Mark Harrington Sunita Kanchinadam Account : markgh skanchin Project : To implement the g_* functions of DEMETER/C++ in DEMETER/Java. Directory : The project is in /proj/asl/lieber/f96/com3360/markgh/g_print/ /proj/asl/lieber/f96/com3360/markgh/g_equal/ How to run the application , Names of files where test inputs can be found, One interesting input/output pair in this file: Answers to these questions: For g_print : The program.cd covers most situations. -------------------------------------- A = "a" B X "enda". B ~ "(" {C} ")". X = "x" Y. Y = . C : D | E. D = "d" Text. E = "e" Integer. Main = . PrintingVisitor = . (program.input) --------------- a ( d (@ ident1 @) e 4 d (@ ident2 @) e 5 ) x enda (program.beh) is generated using: java Program < program.cd > program.beh ------------------------------------------------ (output from program.java) run using : java Main < program.input -------------------------------------- a ( d ident1 e 4 d ident2 e 5 ) x enda Interesting files for g_print and where they can be found: ---------------------------------------------------------- demjava.cd demjava.java (generated) demjava.beh For testing: program.input program.java (generated) program.beh program.cd (serves as input) ================================================================ gequal : equal.cd as input ----------------- A = B C D. B = Integer. C = String. Main = . (input files) ------------- ip1 : 14 "Hello" ip2 : 14 "GoodBye" equal.beh generated beh file using : java Program < equal.cd > equal.beh ----------------------------------------------- output for our example run using: java Main ip1 ip2 ----------------------------------------------- No Interesting files for g_equal and where they can be found: ------------------------------------------------------------ demjava.java demjava.beh demjava.cd equal.cd ip1 ip2 equal.beh equal.java ======================================================================= Class Dictionary : demjava.cd with some changes to implement the visitors. To Do : As we reached the end of the quarter, we had a better understanding of the scope of the project and what we could do more. With the implementation of the first function g_print, we had a better approach and a basis to implement the other functions. Knowing the the path to do something first is always tough, the learning curve to implement the first function was very high considering the fact that we were novices to the world of Adaptive Programming!! We think that we can implement the other generic functions like g_copy(), g_displayAsTree(), g_code() etc given more time. Known bugs: Related to the parts of g_print that we could not do. * Embedded Syntax: A = "(" B "," C ")". This will be easy to do when Demeter/Java supports code attachment to edges of the class graph. * Syntax after *common*: A : B | C *common* "(" D ")". B = "{" S "}". ... ... flattening the class dictionary would give the following class definition for B. B = "{" S "}" "(" D ")". which leads to the embedded syntax situation. We looked at solutions to this problem, but we felt that once the issue of embedded syntax is fixed through the implementation of edge wrappers in Demjava, both problems could be solved more easily at once. For now, we chose to ignore syntax after *common* by using a flag that is set when we visit an alternation class. Any information which you think is useful toreuse your software: We think that for anyone who wants to implement the rest of the generic functions, it would be easier and useful to scan through our code. Also, for some functions like g_copy(), We think that our code can be used with a few changes. Answers : Did you change the generated java code which make generates from the *.cd and *.beh files ? For g_print : NO. For g_equal : The generated java code needs to have the following statement at the top. import java.io* to be able to use the InputStream utility. Did you make any changes to the Makefile that j-gen-make produced? NO. Evaluation of the TA : We think that Doug Orleans was extremely helpful to give a start in the right direction. He also replied to all our mails very promptly and spent time to answer all our questions with a lot of patience.Thanks to him.