Advertisement
Advertisement

More Related Content

Similar to Towards Modular Code Generators Using Symmetric Language-Aware Aspects(20)

Advertisement

Towards Modular Code Generators Using Symmetric Language-Aware Aspects

  1. Towards Modular Code Generators Using Symmetric Language-Aware Aspects Steffen Zschaler, Awais Rashid FREECO’11 Lancaster, 26 July 2011
  2. Motivation Code generators can become quite complex – Generate code related to a number of different concerns / features • Different model elements (global-to-local transformation) • Additional technical concerns (e.g., persistence annotations) – Flexibly combine generation pipeline depending on features required 26/07/2011 (c) Steffen Zschaler 2
  3. Configuring Code Generators 26/07/2011 (c) Steffen Zschaler 3 Application Model Java Code Business Logic Generator Java Data Model Generator
  4. Configuring Code Generators 26/07/2011 (c) Steffen Zschaler 3 Application Model Java Code Business Logic Generator EMF GeneratorGUI Generator plugin.xml
  5. Existing Modularity Techniques • Templates – Typically one template per target file – May produce more than one file 26/07/2011 (c) Steffen Zschaler 4
  6. Existing Modularity Techniques • Templates – Typically one template per target file – May produce more than one file • Generation Rules – Allow hierarchy similar to operations – Good for capturing common design rules 26/07/2011 (c) Steffen Zschaler 4
  7. Existing Modularity Techniques • Templates – Typically one template per target file – May produce more than one file • Generation Rules – Allow hierarchy similar to operations – Good for capturing common design rules • Import of module templates – Allow reuse of rules 26/07/2011 (c) Steffen Zschaler 4
  8. Existing Modularity Techniques • Templates – Typically one template per target file – May produce more than one file • Generation Rules – Allow hierarchy similar to operations – Good for capturing common design rules • Import of module templates – Allow reuse of rules • Asymmetric Aspects – Explicitly address tangling – BUT... 26/07/2011 (c) Steffen Zschaler 4
  9. Drawbacks of Asymmetric AO • Need for a base template 26/07/2011 (c) Steffen Zschaler 5
  10. Drawbacks of Asymmetric AO • Need for a base template • Need for scaffolding 26/07/2011 (c) Steffen Zschaler 5
  11. Drawbacks of Asymmetric AO • Need for a base template • Need for scaffolding • No explicit support for weaving context 26/07/2011 (c) Steffen Zschaler 5
  12. Drawbacks of Asymmetric AO • Need for a base template • Need for scaffolding • No explicit support for weaving context • Not language aware 26/07/2011 (c) Steffen Zschaler 5
  13. Registration + Weaving = Symmetric AO for Code Generation 26/07/2011 (c) Steffen Zschaler 6 CG Template 1 CG Template 2 CG Template n ...
  14. Registration + Weaving = Symmetric AO for Code Generation 26/07/2011 (c) Steffen Zschaler 6 CG Template 1 CG Template 2 CG Template n Code Slice Registry ...
  15. Registration + Weaving = Symmetric AO for Code Generation 26/07/2011 (c) Steffen Zschaler 6 CG Template 1 CG Template 2 CG Template n Code Slice Registry Code Slice Weaver ...
  16. Registration + Weaving = Symmetric AO for Code Generation 26/07/2011 (c) Steffen Zschaler 6 CG Template 1 CG Template 2 CG Template n Code Slice Registry Code Slice Weaver Output Files ...
  17. Registration + Weaving = Symmetric AO for Code Generation 26/07/2011 (c) Steffen Zschaler 6 CG Template 1 CG Template 2 CG Template n Code Slice Registry Code Slice Weaver Output Files ...
  18. Registration + Weaving = Symmetric AO for Code Generation 26/07/2011 (c) Steffen Zschaler 6 CG Template 1 CG Template 2 CG Template n Code Slice Registry Code Slice Weaver Output Files ...
  19. Text Merging • 2-way vs 3-way – We can only support 2-way merging • State-based vs change-based – We can only support state-based merging 26/07/2011 (c) Steffen Zschaler 7 based on Tom Mens’ classification
  20. Text Merging • 2-way vs 3-way – We can only support 2-way merging • State-based vs change-based – We can only support state-based merging • Textual vs syntactic vs semantic – The more semantic the more powerful – But also the more configuration needed! 26/07/2011 (c) Steffen Zschaler 7 based on Tom Mens’ classification
  21. Prototype • Extends Epsilon Generation Language (EGL) – New workflow tasks: eglRegister – generate from a template, but store result in registry eglMerge – merge registry contents for specific files – Can be configured with different text merging algorithms • Distribution uses FeatureHouse • Available from EpsilonLabs: http://epsilonlabs.googlecode.com/ 26/07/2011 (c) Steffen Zschaler 8
  22. Conclusions & Outlook • Asymmetric aspects can address some modularity issues in code generation • Presented a prototype • Larger comparative study of modularity properties currently under way 26/07/2011 (c) Steffen Zschaler 9
  23. THANK YOU FOR YOUR ATTENTION! 26/07/2011 (c) Steffen Zschaler 10
Advertisement