WG211/M9Fischer

From WG 2.11
Jump to: navigation, search


Extending code generators by transforming generated code

Bernd Fischer

Code generated from high-level specifications often requires modification before deployment, but no approach exists that allows an application programmer to make these modifications in a safe, reliable, and systematic way. Hence, incomplete or incorrect generators cannot be changed easily, domain evolution is not supported, and experimenting with new features is not possible. In this talk, I'll show how to modify and extend code generators indirectly, by automatically transforming the generated code. Two related techniques to enable automatic code customizations are explored: i) syntactic customization patches, whose implementation required Stratego to be extended to allow the embedding of concrete syntax in concrete syntax and ii) semantic join points, implemented as Java annotations and weaved into the generated code using AspectJ. Both approaches are based on ideas from aspect-oriented programming, but have opposite characteristics. Customization patches do not require changes to the underlying code generator, but can suffer from the fragile point-cut problem, while semantic join points are stable but require support from the generator. I will describe and evaluate the application of these techniques in the customization of WebDSL, a domain-specific language for modeling dynamic, data-rich web applications.