ebook img

Automated Program and Model Transformation Technology PDF

136 Pages·2005·2.09 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Automated Program and Model Transformation Technology

Automated Program and Model Transformation Technology Ira D. Baxter, Ph.D. Tutorial Overview • Part I. Program Transformation – Transformation Tool overview and Relevance to ADM – Theory of transformation systems – Some transformation systems and applications • Part II. Model Transformation – Model Transformation to Support Model Evolution – Model-Driven Program Transformation © Semantic Designs 2005 2 Who are we? • Dr. Ira D. Baxter – CEO of Semantic Designs – 35 years Software Engineering: OS, Compilers, Transform Systems, Reuse – Architect of Design Maintenance System (DMS) • Dr. Jeff Gray – CIS Department, University of Alabama at Birmingham • Assistant Professor • Research Focus: Software engineering, model-integrated computing, generative programming, aspect-oriented software development – PhD from Vanderbilt University • Institute for Software Integrated Systems (ISIS) – 2000-2005: DARPA PCES Project on Model-Driven Transformation – 2005-2007: NSF CSR Project on Model-driven Performance Analysis © Semantic Designs 2005 3 Contents � Introduction • Theory • Implementation • Some Transformation Systems • Applications • Summary © Semantic Designs 2005 4 Transformation Systems Stepwise Semiautomatic Conversion of Specs to Code Spec Rqmts Prog Transform f S t i Engine fG Transforms aka “rules” distributive unity remove like-term factoring law multiplier parentheses combination t t t t t 1 2 k-2 k-1 k f S f1 ... fk-1 fk fG (x-1)y+2y (xy-1y)+2y xy-y+2y xy+y (x+1)y © Semantic Designs 2005 5 Spec Transformed to code with Transforms: Summing A Unix File Specification f S print sum(<file:"invoices">); Some sequence of transforms t1, t2, … tk local s,i,n1,f1,v1; s=0; f1=new filehandle; open f1,"invoices"; n1=0; while not(eof(f1)) Implementation f do { position f1,sizeof(v1)*n1; G read f1,v1; n1=n1+1; s=s+v1; } close f1; free(f1); print s; © Semantic Designs 2005 6 A Simple Example: Summing A Unix File Specification print sum(<file:"invoices">); t1 local s,i,t1; s=0; local n1,f1,v1; n1=0; print ( local s,i; s=0; f1=new filehandle; open f1,"invoices"; for i=1 to length(<file:"invoices">) while not(eof(f1)) do { s=s+<file:"invoices.txt">[i]; } { read f1,v1; n1=n1+1;}; s ); close(f1); free(f1); t1=n1; for i=1 to t1 t2 { s=s+<file:"invoices">[i]; } print s; local s,i; s=0; for i s=1s +t<of ilen:g"tihn(v<ofiiclees:."tixntv"o>i[cie]s;">) t6 print s; local s,i,n1,f1,v1; s=0; n1=0; t3 f1=new filehandle; open f1,"invoices"; while not(eof(f1)) do local s,i; s=0; { read f1,v1; n1=n1+1;}; for i=1 to (local n,f,v; n=0; f=new filehandle; close(f1); free(f1); open f,"invoices"; for i=1 to n1 while not(eof(f)) do { s=s+<file:"invoices">[i]; } { read f,v; n=n+1; }; print s; close(f); free(f); s=s+<file:p")invoices">[i]; t7 print s; local s,i,n1,f1,v1; s=0; n1=0; f1=new filehandle; open f1,"invoices"; t4 while not(eof(f1)) do { read f1,v1; n1=n1+1;}; local s,i; s=0; close(f1); free(f1); local t1; for i=1 to n1 { local n,f,v; n=0; t5 { s=s+(local v,f; f=new filehandle; f=new filehandle; open f,"invoices"; open f,"invoices"; while not(eof(f)) do position f,sizeof(v)*(i-1); { read f,v; n=n+1}; read f,v; close f; free f; v); close(f); free(f); t1=n}; } for i=1 to t1 print s; { s=s+<file:"invoices">[i]; } print s; t8 Naïve intermediate program Opens file and reads it twice © Semantic Designs 2005 7 t8 local s,i,n1,f1,v1; s=0; n1=0; f1=new filehandle; open f1,"invoices"; local s,i,n1,f1,v1; s=0; n1=0; A Simple Example II while not(eof(f1)) f1=new filehandle; open f1,"invoices"; do { read f1,v1; n1=n1+1;}; while not(eof(f1)) close(f1); free(f1); do { position f1,sizeof(v1)*n1; for i=1 to p1 read f1,v1; n1=n1+1;}; Transforms on this page optimize { s=s+(local v,f; f=new filehandle; close(f1); open f,"invoices"; for i=1 to n1 naïve program into efficient one position f,sizeof(v)*(i-1); { local v2; open f1,"invoices"; read f,v; close f; free(f); v); position f1,sizeof(v2)*(i-1); } read f1,v2; close f1; print s; s=s+v2; } More transforms t9 free(f1); print s; local s,i,n1,f1,v1; s=0; n1=0; local s,i,n1,f1,v1; s=0; f1=new filehandle; open f1,"invoices"; f1=new filehandle; open f1,"invoices"; while not(eof(f1)) n1=0; while not(eof(f1)) do { position f1,sizeof(v1)*n1; local s,i,n1,f1,v1, v2; s=0; n1=0; do { position f1,sizeof(v1)*n1; read f1,v1; n1=n1+1;}; f1=new filehandle; open f1,"invoices"; read f1,v1; n1=n1+1;}; close(f1); free(f1); while not(eof(f1)) i=0; while i<=n1-1 for i=1 to n1 do { position f1,sizeof(v1)*n1; do { position f1,sizeof(v1)*i; { local v2,f2; f2=new filehandle; read f1,v1; n1=n1+1;}; read f1,v1; i=i+1; open f2,"invoices"; close(f1); open f1,"invoices"; s=s+v1; } position f2,sizeof(v2)*(i-1); for i=0 to n1-1 close f1; free(f1); print s; read f2,v2; close f2; free(f2); { position f1,sizeof(v2)*i; s=s+v2; read f1,v2; s=s+v2; } } print s; close f1; free(f1); print s; t10 t k local s,i,n1,f1,v1; s=0; n1=0; f1=new filehandle; open f1,"invoices"; while not(eof(f1)) local s,i,n1,f1,v1,v2; s=0; do { position f1,sizeof(v1)*n1; f1=new filehandle; open f1,"invoices"; fcLolor {oc salie pl r s=o(o =ec1fsfsa a1i2+dlt)t;rv o;i ef2v ofa;2n2fn2d,;1r = v efnf2oe2e1;p(,w, efsvcn1fi1l )iz;of;le s2eone,hf1 "a(=finvn2nd21;vl)+oe*1i(;ci}e-;s1"); in=10=d;d0o o;w h{w} i hplpiroelo=es seiai +dt<tn1 i=io;fonot1n1n(,- evf1fo211f1;,(, sfsni1i=1z)s=e)+nov1f2+(;1v;21});*in;1; lfnco1lc=oand0sleo;e w s{wf,f h1ipir;s,lole =neseafs1hi dr+,atn evfniofe11dot1(;,ln(,f ve ev1}1;fo1); 1f; o,( spsfnp=ei1r0nz)=i; e)n fo1t1f+ ,(1s"v;i1n)v*oni1c;es"; } close f1; free(f1); print s; free(f2); print s; © Semantic Designs 2005 8 A Simple Example: A transformed spec t 2 local s,i; s=0; for i=1 to length(<file:"invoices">) s=s+<file:"invoices.txt">[i]; print s; t 3 local s,i; s=0; for i=1 to (local n,f,v; n=0; f=new filehandle; open f,"invoices"; while not(eof(f)) do { read f,v; n=n+1; }; close(f); free(f); p) s=s+<file:"invoices">[i]; print s; © Semantic Designs 2005 9 A Simple Example: Some of the Transforms Used (local n,f,v; n=0; f=new filehandle; open f,"filename"; while not(eof(f)) do t 3 length(<file:"filename"> { read f,v; n=n+1; }; close(f); free(f); p) (local v,f; f=new filehandle; open f,"filename"; t 7 <file:"filename">[i] position f,sizeof(v)*(i-1); read f,v; close f; free f; v) for i=lb to ub local f; f=new filehandle; { code1 // that doesn’t touch f for i=lb to ub local f; f=new filehandle; { code1 t code3 // that doesn’t free f code3 10 free(f); code2 code2 // that doesn’t touch f } } free(f) © Semantic Designs 2005 10

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.