see /proj/adaptive/lieber/regression-test lieber faculty 512 Jun 15 08:10 f-prop-merge/ lieber faculty 512 Jun 14 14:11 f-cd1/ lieber faculty 512 Jun 14 14:09 f-transp/ lieber demeter 7168 Jun 14 11:51 ./ lieber faculty 512 Jun 13 17:11 f-pd-abs/ Question 1: =========== Consider the following 5 class dictionaries cd1, ... ,cd5 and the 4 propagation patterns f1, ... ,f4. cd1: Ex = PCList(A). PCList(S) ~ "(" S { "," S } ")". A = K Z. K = L. L = Z. Z = . -------------------------------------------------- cd2: Ex = PCList(A). PCList(S) ~ "(" S { "," S } ")". A = D Z. D = Z K. K = ["l" L]. L = A. Z = . -------------------------------------------------- cd3: Ex = PCList(A). PCList(S) ~ "(" S { "," S } ")". A = D Z. D = K U. U = ["a" A]. K = Z ["l" L]. L = U. Z = . -------------------------------------------------- cd4: Ex = PCList(A). PCList(S) ~ "(" S { "," S } ")". A = D Z. D = K. K = L. L = Z. Z = . V1 : D | U1 *common* V2. V2 : U2 | Z. U1 = "u1". U2 = "u2". -------------------------------------------------- cd5: Ex = PCList(A). PCList(S) ~ "(" S { "," S } ")". A = D. D : K | Z. K = ["l" L]. L = Z. Z = . -------------------------------------------------- The 4 propagation patterns are: *operation* void f1() *traverse* *from* Ex *to* Z *wrapper* Z *prefix* (@ cout << this << endl; @) *wrapper* A *suffix* (@ cout << "f1 after traversing A ------------------" << endl; @) *operation* void f2() *traverse* *from* Ex *via* K *to* Z *wrapper* Z *prefix* (@ cout << this << endl; @) *wrapper* A *suffix* (@ cout << "f2 after traversing A ------------------" << endl; @) *operation* void f3() *traverse* *from* Ex *bypassing* -> K,l,L *to* Z *wrapper* Z *prefix* (@ cout << this << endl; @) *wrapper* A *suffix* (@ cout << "f3 after traversing A ------------------" << endl; @) *operation* void f4() *traverse* *from* Ex *through* -> K,l,L *to* Z *wrapper* Z *prefix* (@ cout << this << endl; @) *wrapper* A *suffix* (@ cout << "f4 after traversing A ------------------" << endl; @) For which combinations of class dictionary and propagation pattern is there information loss (= inconsistency) between the propagation directive in the pp and the class dictionary? cd1 cd2 cd3 cd4 cd5 f1 -----|-------|-------|-------|-------|------ f2 -----|-------|-------|-------|-------|------ f3 -----|-------|-------|-------|-------|------ f4 -----|-------|-------|-------|-------|------ Mark the squares for which there IS information loss. For example, between the propagation directive in f1 and cd1 there is no information loss. Therefore f1/cd1 is not marked. If there is information loss, give a short-cut path, e.g. A,D,K,Z means that the short-cut path goes from A to D to K to Z. Put your answer for propagation directive in fi and class dictioanry cdj into UNKNOWNij. For example UNKNOWN13 contains nothing if there is no information loss for f1 and cd3 and otherwise, UNKNOWN13 contains a short-cut. Question 2: =========== Consider the following two class dictionaries: cd1/abstract A = K. K = O. O = Z. Z = . cd2/abstract A = B Z. B = K Z. K = L. L = O. O = S Z. S = Z. Z = . Propagation graph for cd1/abstract: *source* { A } *target* { Z } *paths* A = < k > K . K = < o > O . O = < z > Z . Z = . Propagation graph for cd1/abstract: *source* { A } *target* { Z } *paths* A = < b > B . B = < k > K . K = < l > L . L = < o > O . O = < s > S < z3 > Z . S = < z4 > Z . Z = . Find a propagation directive which computes the two propagation graphs for the two class dictionaries above. The propagation directive is *from* UNKNOWN Question 3: =========== Find class dictionary Consider the following sentence { FROM {A,B} TO {C,D}, (MERGE FROM {A} TO {B}, FROM {A} TO {C}), (MERGE (JOIN FROM {A} TO {B}, FROM {B} TO {C}), (JOIN FROM {A} TO {X}, FROM {X} TO {C})) } and the following class dictionary: Ex = PCommaList(E). E : S | J | M. S = "FROM" PCommaList(Vertex) "TO" PCommaList(Vertex). J = "(JOIN" E "," E ")". M = M1. M1 = "(MERGE" E "," E ")". Vertex = DemIdent. PCommaList(S) ~ "{" S {"," S} "}". The sentence is legal with respect to the class dictionary. Find the UNKNOWNS. The following propagation pattern finds all merge expressions and for each such merge expression it finds all containing FROM-TO expressions which are not contained in a nested MERGE expression. // FROM inside MERGE *operation* void FROMinsideMERGE() *traverse* *from* Ex *to* M1 *wrapper* M1 *prefix* (@ this -> find_FROM(); @) *operation* void find_FROM() *traverse* *from* M1 *bypassing* -> *,m1,* *to* S // begin transportation pattern *carry* *in* M1* merge = (@ this @) *along* *from* M1 *to* S *wrapper* S *prefix* (@ cout << "basic " << this << endl << "contained in " << merge << endl; @) // end transportation pattern : Ex ( < e_pcommalist > : E_PCommaList { : S ( < sources > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "A" ) , : Vertex ( < demident > : DemIdent "B" ) } < targets > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "C" ) , : Vertex ( < demident > : DemIdent "D" ) } ) , : M ( < m1 > : M1 ( < arg1 > : S ( < sources > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "A" ) } < targets > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "B" ) } ) < arg2 > : S ( < sources > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "A" ) } < targets > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "C" ) } ) ) ) , : M ( < m1 > : M1 ( < arg1 > : M ( < m1 > : M1 ( < arg1 > : S ( < sources > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "A" ) } < targets > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "B" ) } ) < arg2 > : S ( < sources > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "B" ) } < targets > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "C" ) } ) ) ) < arg2 > : M ( < m1 > : M1 ( < arg1 > : S ( < sources > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "A" ) } < targets > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "X" ) } ) < arg2 > : S ( < sources > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "X" ) } < targets > : Vertex_PCommaList { : Vertex ( < demident > : DemIdent "C" ) } ) ) ) ) ) } ) >> void Ex::FROMinsideMERGE(), "1-DEM.C", line 8 >> void E_PCommaList::FROMinsideMERGE(), "1-DEM.C", line 120 >> void E::FROMinsideMERGE(), "1-DEM.C", line 31 >> at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << void E::FROMinsideMERGE(), "1-DEM.C", line 31 >> void M::FROMinsideMERGE(), "1-DEM.C", line 70 >> void M1::FROMinsideMERGE(), "1-DEM.C", line 96 >> void M1::find_FROM(), "1-DEM.C", line 216 >> void S::find_FROM(M1* merge), "1-DEM.C", line 162 basic FROM { A } TO { B } contained in (MERGE FROM { A } TO { B } , FROM { A } TO { C } ) << void S::find_FROM(M1* merge), "1-DEM.C", line 162 >> void S::find_FROM(M1* merge), "1-DEM.C", line 162 basic FROM { A } TO { C } contained in (MERGE FROM { A } TO { B } , FROM { A } TO { C } ) << void S::find_FROM(M1* merge), "1-DEM.C", line 162 << void M1::find_FROM(), "1-DEM.C", line 216 >> void E::FROMinsideMERGE(), "1-DEM.C", line 31 >> at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << void E::FROMinsideMERGE(), "1-DEM.C", line 31 >> void E::FROMinsideMERGE(), "1-DEM.C", line 31 >> at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << void E::FROMinsideMERGE(), "1-DEM.C", line 31 << void M1::FROMinsideMERGE(), "1-DEM.C", line 96 << void M::FROMinsideMERGE(), "1-DEM.C", line 70 >> void M::FROMinsideMERGE(), "1-DEM.C", line 70 >> void M1::FROMinsideMERGE(), "1-DEM.C", line 96 >> void M1::find_FROM(), "1-DEM.C", line 216 >> void E::find_FROM(M1* merge), "1-DEM.C", line 149 >> at M , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 151 << at M , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 151 << void E::find_FROM(M1* merge), "1-DEM.C", line 149 >> void E::find_FROM(M1* merge), "1-DEM.C", line 149 >> at M , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 151 << at M , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 151 << void E::find_FROM(M1* merge), "1-DEM.C", line 149 << void M1::find_FROM(), "1-DEM.C", line 216 >> void M::FROMinsideMERGE(), "1-DEM.C", line 70 >> void M1::FROMinsideMERGE(), "1-DEM.C", line 96 >> void M1::find_FROM(), "1-DEM.C", line 216 >> void S::find_FROM(M1* merge), "1-DEM.C", line 162 basic FROM { A } TO { B } contained in (MERGE FROM { A } TO { B } , FROM { B } TO { C } ) << void S::find_FROM(M1* merge), "1-DEM.C", line 162 >> void S::find_FROM(M1* merge), "1-DEM.C", line 162 basic FROM { B } TO { C } contained in (MERGE FROM { A } TO { B } , FROM { B } TO { C } ) << void S::find_FROM(M1* merge), "1-DEM.C", line 162 << void M1::find_FROM(), "1-DEM.C", line 216 >> void E::FROMinsideMERGE(), "1-DEM.C", line 31 >> at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << void E::FROMinsideMERGE(), "1-DEM.C", line 31 >> void E::FROMinsideMERGE(), "1-DEM.C", line 31 >> at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << void E::FROMinsideMERGE(), "1-DEM.C", line 31 << void M1::FROMinsideMERGE(), "1-DEM.C", line 96 << void M::FROMinsideMERGE(), "1-DEM.C", line 70 >> void M::FROMinsideMERGE(), "1-DEM.C", line 70 >> void M1::FROMinsideMERGE(), "1-DEM.C", line 96 >> void M1::find_FROM(), "1-DEM.C", line 216 >> void S::find_FROM(M1* merge), "1-DEM.C", line 162 basic FROM { A } TO { X } contained in (MERGE FROM { A } TO { X } , FROM { X } TO { C } ) << void S::find_FROM(M1* merge), "1-DEM.C", line 162 >> void S::find_FROM(M1* merge), "1-DEM.C", line 162 basic FROM { X } TO { C } contained in (MERGE FROM { A } TO { X } , FROM { X } TO { C } ) << void S::find_FROM(M1* merge), "1-DEM.C", line 162 << void M1::find_FROM(), "1-DEM.C", line 216 >> void E::FROMinsideMERGE(), "1-DEM.C", line 31 >> at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << void E::FROMinsideMERGE(), "1-DEM.C", line 31 >> void E::FROMinsideMERGE(), "1-DEM.C", line 31 >> at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << at S , *** PREMATURELY TERMINATED *** , "1-DEM.C", line 33 << void E::FROMinsideMERGE(), "1-DEM.C", line 31 << void M1::FROMinsideMERGE(), "1-DEM.C", line 96 << void M::FROMinsideMERGE(), "1-DEM.C", line 70 << void M1::FROMinsideMERGE(), "1-DEM.C", line 96 << void M::FROMinsideMERGE(), "1-DEM.C", line 70 << void E_PCommaList::FROMinsideMERGE(), "1-DEM.C", line 120 << void Ex::FROMinsideMERGE(), "1-DEM.C", line 8 Consider the class dictionary cd5 and the following propagation pattern and the C++ code. Find the UNKNOWNs. cd5 (from question 1) Ex = PCList(A). PCList(S) ~ "(" S { "," S } ")". A = D. D : K | Z. K = ["l" L]. L = Z. Z = . *operation* void f4() *traverse* *from* Ex *through* -> K,l,L *to* Z *wrapper* Z *prefix* (@ cout << this << endl; @) *wrapper* A *suffix* (@ cout << "f4 after traversing A ------------------" << endl; @) The C++ memberfunctions: // Ex = A_PCList . void Ex::f4( ) { // outgoing calls this->get_a_pclist()->f4( ); } // A = D . void A::f4( ) { // outgoing calls this->get_d()->f4( ); // suffix class wrappers cout << "f4 after traversing A ------------------" << endl; } // D : K | // Z // *common* . void D::f4( ) { DEM_TRACE("D","void D::f4()"); #ifndef NOTRACE DemTrace demTraceEmptyMethod(__FILE__,__LINE__,"D",form(" at %s , *** PREMATURELY TERMINATED *** ", this->get_type())); #endif } // K = [ L ] . void K::f4( ) { DEM_TRACE("K","void K::f4()"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers // outgoing calls if ( this->get_l() != NULL ) { // construction edge prefix wrappers this->get_l()->f4( ); // construction edge prefix wrappers } // suffix class wrappers // assignments for carrying out } // L = Z . void L::f4( ) { DEM_TRACE("L","void L::f4()"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers // outgoing calls // construction edge prefix wrappers this->get_z()->f4( ); // construction edge suffix wrappers // suffix class wrappers // assignments for carrying out } // Z = . void Z::f4( ) { DEM_TRACE("Z","void Z::f4()"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers cout << this << endl; // outgoing calls // suffix class wrappers // assignments for carrying out } // A_PCList ~ A { A }. . void A_PCList::f4( ) { DEM_TRACE("A_PCList","void A_PCList::f4()"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers // outgoing calls A_list_iterator next_A(*this); A* each_A; while ( each_A = next_A() ) { // repetition edge prefix wrappers each_A->f4( ); // repetition edge suffix wrappers } // suffix class wrappers // assignments for carrying out } Consider the C++ member functions below. What is the corresponding class dictionary. Put it into UNKNOWN. The member functions come from the following propagation pattern which contains two transportation patterns. Find the unknowns. Propagation pattern ----------------------------------------------- *operation* void f() *traverse* *from* A *to* {B,C} ////// transportation pattern 1 *carry* *out* B* b1 *along* *from* A *to* B *at* B b1 = (@ this @) *carry* *out* C* c1 *along* *from* A *to* C *at* C c1 = (@ this @) *wrapper* A *suffix* (@ cout << b1 << c1 << this << endl; @) ////// end transportation pattern 1 ////// transportation pattern 2 *carry* A* a1 = (@ this @) *along* *from* A *to* {B,C} *wrapper* {B,C} *prefix* (@ cout << "a " << a1 << this << endl; @) ////// end transportation pattern 2 *wrapper* -> *,*,* *prefix* (@ cout << "traversing construction edge" << endl; @) C++ member functions ----------------------------------------------- // A = "a" // B // C . void A::f( ) { DEM_TRACE("A","void A::f()"); // variables for carrying in and out B* b1 ; C* c1 ; A* a1 = this ; // assignments for carrying in // prefix class wrappers // outgoing calls // construction edge prefix wrappers cout << "traversing construction edge" << endl; this->get_b()->f( b1 , a1 ); // construction edge suffix wrappers // construction edge prefix wrappers cout << "traversing construction edge" << endl; this->get_c()->f( c1 , a1 ); // construction edge suffix wrappers // suffix class wrappers cout << b1 << c1 << this << endl; // assignments for carrying out } // B = "b" . void B::f( B* & b1,A* a1 ) { DEM_TRACE("B","void B::f(B* & b1,A* a1)"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers cout << "a " << a1 << this << endl; // outgoing calls // suffix class wrappers // assignments for carrying out b1 = this ; } // C = "c" . void C::f( C* & c1,A* a1 ) { DEM_TRACE("C","void C::f(C* & c1,A* a1)"); // variables for carrying in and out // assignments for carrying in // prefix class wrappers cout << "a " << a1 << this << endl; // outgoing calls // suffix class wrappers // assignments for carrying out c1 = this ; } Parsing in object in: demeter-input. Drawing the parsed object: A HAS 2 PARTS( B HAS 0 PART() C HAS 0 PART()) End of drawing. Copying the object. Displaying the copied object as a tree: : A ( < b > : B ( ) < c > : C ( ) ) End of display. Comparing the two objects: copied and original object are equal Pretty printing the parsed object: a b c End of printing. Selftest of generic parser/printer: g_parse and g_parse( g_print( g_parse ) ) are equal. Selftest passed. >> void A::f(), "1-DEM.C", line 10 traversing construction edge >> void B::f(B* & b1,A* a1), "1-DEM.C", line 39 a a b c b << void B::f(B* & b1,A* a1), "1-DEM.C", line 39 traversing construction edge >> void C::f(C* & c1,A* a1), "1-DEM.C", line 58 a a b c c << void C::f(C* & c1,A* a1), "1-DEM.C", line 58 b c a b c << void A::f(), "1-DEM.C", line 10 *** FINISHED ***