A generative programming approach to developing DSL compilers

Domain-Specific Languages (DSLs) represent a proven approach to raising the abstraction level of programming. They offer high-level constructs and notations dedicated to a domain, structuring program design, easing program writing, masking the intricacies of underlying software layers, and guaranteeing critical properties. On the one hand, DSLs facilitate a straightforward mapping between a conceptual model and a solution expressed in a specific programming language. On the other hand, DSLs complicate the compilation process because of the gap in the abstraction level between the source and target language. The nature of DSLs make their compilation very different from the compilation of common General-Purpose Languages (GPLs). In fact, a DSL compiler generally produces code written in a GPL; low-level compilation is left to the compiler of the target GPL. In essence, a DSL compiler defines some mapping of the high-level information and features of a DSL into the target GPL and underlying layers (e.g., middleware, protocols, objects, ...). This paper presents a methodology to develop DSL compilers, centered around the use of generative programming tools. Our approach enables the development of a DSL compiler to be structured on facets that represent dimensions of compilation. Each facet can then be implemented in a modular way, using aspects, annotations and specialization. Because these tools are high level, they match the needs of a DSL, facilitating the development of the DSL compiler, and making it modular and re-targetable. We illustrate our approach with a DSL for telephony services. The structure of the DSL compiler is presented, as well as practical uses of generative tools for some compilation facets.

[1]  Laurent Burgy,et al.  A comparative study of SIP programming interfaces , 2004 .

[2]  Gregor Kiczales,et al.  Aspect-oriented programming , 2001, ESEC/FSE-9.

[3]  Laurent Burgy,et al.  Telephony Software Engineering: A Domain-Specific Language Approach , 2005 .

[4]  Pascal Fradet,et al.  Unconventional Programming Paradigms, International Workshop UPP 2004, Le Mont Saint Michel, France, September 15-17, 2004, Revised Selected and Invited Papers , 2005, UPP.

[5]  Adam Roach,et al.  Session Initiation Protocol (SIP)-Specific Event Notification , 2002, RFC.

[6]  Ian D. Benest,et al.  Chapter 3 – An Overview of Aspect , 1991 .

[7]  Satoshi Matsuoka,et al.  ECOOP'97 — Object-Oriented Programming , 1997, Lecture Notes in Computer Science.

[8]  George C. Necula,et al.  Enforcing Resource Bounds via Static Verification of Dynamic Checks , 2005, ESOP.

[9]  Krzysztof Czarnecki,et al.  Generative programming - methods, tools and applications , 2000 .

[10]  Olivier Danvy,et al.  Tutorial notes on partial evaluation , 1993, POPL '93.

[11]  Walid Taha,et al.  A Gentle Introduction to Multi-stage Programming , 2003, Domain-Specific Program Generation.

[12]  William G. Griswold,et al.  An Overview of AspectJ , 2001, ECOOP.

[13]  William G. Griswold,et al.  Getting started with ASPECTJ , 2001, CACM.

[14]  Krzysztof Czarnecki,et al.  Overview of Generative Software Development , 2004, UPP.

[15]  Hugh Glaser,et al.  Principles of Declarative Programming , 1998, Lecture Notes in Computer Science.

[16]  Charles Consel,et al.  Architecture Software Using: A Methodology for Language Development , 1998, PLILP/ALP.

[17]  Jørgen Lindskov Knudsen ECOOP 2001 — Object-Oriented Programming , 2001, Lecture Notes in Computer Science.

[18]  Martin Odersky,et al.  Domain-Specific Program Generation , 2004, Lecture Notes in Computer Science.

[19]  Cristina V. Lopes,et al.  Aspect-oriented programming , 1999, ECOOP Workshops.

[20]  Mark Handley,et al.  SIP: Session Initiation Protocol , 1999, RFC.

[21]  Peter Sestoft,et al.  Partial evaluation and automatic program generation , 1993, Prentice Hall international series in computer science.

[22]  Charles Consel,et al.  From a Program Family to a Domain-Specific Language , 2003, Domain-Specific Program Generation.

[23]  Julia L. Lawall,et al.  Static and Dynamic Program Compilation by Interpreter Specialization , 2000, High. Order Symb. Comput..