Type-Safe Model Transformation Languages as Internal DSLs in Scala
Although there are powerful model transformation languages (MTLs) like ATL, model-to-model transformations still are often implemented in general-purpose languages (GPLs) like Java, especially in EMF-based projects. Developers might hesitate to learn another language, use new tools, or they feel limited by the specific but less versatile constructs an MTL provides. However, model transformation code written in a GPL is less readable, contains redundancies or verbose expressions, and there are fewer possibilities for formal reasoning. Our approach combines some benefits of MTLs with GPL programming. We use the GPL Scala to realize MTLs similar to ATL as internal domain-specific languages. The benefits are seamless integration with EMF and state-of-the-art tool support as well as the possibility to extend MTLs and to mix MTL and GPL code. In contrast to similar approaches with dynamically typed languages like Ruby, Scala allows for static type-safety without adding syntactic clutter.
KeywordsTarget Object Model Transformation Case Class Type Inference Transformation Language
Unable to display preview. Download preview PDF.
- 6.Czarnecki, K., Helsen, S.: Classification of model transformation approaches. In: 2nd Workshop on Generative Techniques in the Context of MDA, pp. 1–17 (2003)Google Scholar
- 7.Fowler, M.: Domain-Specific Languages. Addison-Wesley (October 2010)Google Scholar
- 8.Günther, S., Cleenewerck, T.: Design Principles for Internal Domain-Specific Languages: A Pattern Catalog illustrated by Ruby. In: 17th Conference on Pattern Languages of Programs, PLoP (2010)Google Scholar
- 9.Halstead, M.: Elements of Software Science. Elsevier Science Inc. (1977)Google Scholar
- 10.Hofer, C., Ostermann, K., Rendel, T., Moors, A.: Polymorphic Embedding of DSLs. In: 7th Conference on Generative Programming and Component Engineering, GPCE 2008, pp. 137–148. ACM (2008)Google Scholar
- 12.Kiselyov, O., Lämmel, R., Schupke, K.: Strongly typed heterogeneous collections. In: Haskell 2004: ACM SIGPLAN Workshop on Haskell, pp. 96–107. ACM (2004)Google Scholar
- 13.Picard, C.: Model Transformation with Scala. Master’s thesis, Universitat Politècnica de Catalunya (2008)Google Scholar
- 14.Pointner, R.: An Evaluation of Scala as a host language for DSLs. Tech. rep., University of Central Lancashire (June 2010)Google Scholar
- 17.Wider, A.: Towards Combinators for Bidirectional Model Transformations in Scala. In: 4th Conference on Software Language Engineering (SLE 2011). Springer (2012)Google Scholar