Interoperable domain-specific languages families for code generation

Authors

  • Michal Malohlava,

    1. Charles University, Faculty of Mathematics and Physics, Department of Distributed and Dependable Systems, Prague, Czech Republic
    Search for more papers by this author
  • Frantisek Plasil,

    Corresponding author
    1. Institute of Computer Science, Academy of Sciences of the Czech Republic, Prague, Czech Republic
    • Charles University, Faculty of Mathematics and Physics, Department of Distributed and Dependable Systems, Prague, Czech Republic
    Search for more papers by this author
  • Tomas Bures,

    1. Charles University, Faculty of Mathematics and Physics, Department of Distributed and Dependable Systems, Prague, Czech Republic
    2. Institute of Computer Science, Academy of Sciences of the Czech Republic, Prague, Czech Republic
    Search for more papers by this author
  • Petr Hnetynka

    1. Charles University, Faculty of Mathematics and Physics, Department of Distributed and Dependable Systems, Prague, Czech Republic
    Search for more papers by this author

Correspondence to: Frantisek Plasil, Distributed and Dependable Systems, Charles University, Malostranske namesti 25, Prague 1, 118 00, Czech Republic.

E-mail: plasil@d3s.mff.cuni.cz

SUMMARY

This paper has been motivated by experience gained with specification and code generation of control elements for a software component platform and general-purpose programming language like Java and C. The problem to be addressed is two-fold: first, several domain-specific languages (DSL) are to be employed to express different element concerns (architecture, deployment context, code pattern) and second, porting to another general-purpose language should avoid modification of the specification and related code generation process as much as possible. In both respects, the classical template-based code generation technique proved to be inflexible, requiring the code generator to be blurred with ad hoc encoded DSL facets. The paper addresses the problem by introducing the concept of interoperable DSL family. Each member of the family is built around its core language, which can be further specialized by embedding into a target programming language. Interoperability of these DSLs is achieved at the level of abstract syntax trees (ASTs) with help of queries. As a proof of the concept, we have implemented the queries via the AST transformation rules of the Stratego/XT framework. In the evaluation, we provide a comparison with the original template-based implementation, which clearly indicates the DSL family and AST transformation benefits. We also provide examples of application areas where the concept of interoperable DSL family can be employed (and also indicate how this can be accomplished). Copyright © 2012 John Wiley & Sons, Ltd.

Ancillary