A Brief Stratego/XT TutorialKarl Trygve KallebergEelco VisserDagstuhl Workshop: Beyond Program Slicing, 7.-11. Nov 2005Plan of AttackI Explain the basics of StrategoI Terms, signatures, rewrite rules, strategies, concrete syntax,dynamic rulesI Motivate with a small case-studyI Constant propagationI Give a tiny tool demoI Take questionsOutline1 Motivation2 Terms and Signatures3 Transformation Rules4 Transfo Strategies5 Dynamic RulesPart IMotivationfor i := 1 to n dofor j := 1 to n doc[i,j] := let var d := 0in for k := 1 to n dod := d + a[i,k] * b[k,j];dendlet var din for i := 1 to n dofor j := 1 to n do(d := 0;for k := 1 to n do d := d + a[i,k] * b[k,j];c[i,j] := d)endExample: Desugaringfor i := 1 to n dofor j := 1 to n doc[i,j] := sum k = 1 to n (a[i,k] * b[k,j])let var din for i := 1 to n dofor j := 1 to n do(d := 0;for k := 1 to n do d := d + a[i,k] * b[k,j];c[i,j] := d)endExample: Desugaringfor i := 1 to n dofor j := 1 to n doc[i,j] := sum k = 1 to n (a[i,k] * b[k,j])for i := 1 to n dofor j := 1 to n doc[i,j] := let var d := 0in for k := 1 to n dod := d + a[i,k] * b[k,j];dendExample: Desugaringfor i := 1 to n dofor j := 1 to n doc[i,j] := sum k = 1 to n (a[i,k] * b[k,j])for i := 1 to n dofor j := 1 to n doc[i,j] := let var d := 0in for k := 1 to n dod := d + a[i,k] * b[k,j];dendlet var din for i := 1 to n dofor j := 1 to n do(d := 0;for k := 1 to n do d := d + a[i,k] * b[k,j];c[i,j] := d)endThe ...
Voir