Interoperable domain‐specific languages families for code generation. (27th April 2012) - Malohlava, Michal; Plasil, Frantisek; Bures, Tomas; Hnetynka, Petr
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.