100 likes | 243 Views
Towards Modular Code Generators Using Symmetric Language-Aware Aspects. Steffen Zschaler , Awais Rashid FREECO’11 Lancaster, 26 July 2011. Motivation. Code generators can become quite complex Generate code related to a number of different concerns / features
E N D
Towards Modular Code Generators Using SymmetricLanguage-Aware Aspects Steffen Zschaler, Awais Rashid FREECO’11 Lancaster, 26 July 2011
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 (c) Steffen Zschaler
Configuring Code Generators Application Model GUI Generator Java Data Model Generator EMF Generator Business Logic Generator plugin.xml Java Code (c) Steffen Zschaler
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... (c) Steffen Zschaler
Drawbacks of Asymmetric AO • Need for a base template • Need for scaffolding • No explicit support for weaving context • Not language aware (c) Steffen Zschaler
Registration + Weaving = Symmetric AO for Code Generation Code Slice Registry CG Template 1 Output Files CG Template 2 Code Slice Weaver ... CG Template n (c) Steffen Zschaler
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! based on Tom Mens’ classification (c) Steffen Zschaler
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: https://sourceforge.net/apps/mediawiki/epsilonlabs/ (c) Steffen Zschaler
Conclusions & Outlook • Asymmetric aspects can address some modularity issues in code generation • Presented a prototype • Larger comparative study of modularity properties currently under way (c) Steffen Zschaler
Thank you for your Attention! (c) Steffen Zschaler