Metacasanova: an optimized meta-compiler for domain-specific languages

Domain-Specific Languages (DSL's) offer language-level abstractions that General-Purpose Languages do not offer, thus speeding up the implementation of the solution of problems within a specific domain. Developers have the choice of developing a DSL by building an interpreter/compiler for it, which is a hard and time-consuming task, or embedding it in a host language, thus speeding up the development process but losing several advantages that having a dedicated compiler might bring. In this work we present a meta-compiler called Metacasanova, whose meta-language is based on operational semantics. Then, we propose a language extension with functors and modules that allows to embed the type system of a language definition inside the meta-type system of Metacasanova and improves the performance of manipulating data structures at run-time. Our results show that Metacasanova dramatically reduces the code lines required to develop a compiler, and that the running time of the Meta-program is improved by embedding the host language type system in the meta-type system with the use of functors in the meta-language.

[1]  Giuseppe Maggiore,et al.  Building Game Scripting DSL's with the Metacasanova Metacompiler , 2016, INTETAIN.

[2]  Mohamed Abbadi,et al.  Casanova 2: A domain specific language for general game development , 2017 .

[3]  T. Sheard Template Metaprogramming for Haskell , 2014 .

[4]  M Mernik,et al.  When and how to develop domain-specific languages , 2005, CSUR.

[5]  Gilles Kahn,et al.  Natural Semantics , 1987, STACS.

[6]  Eelco Visser,et al.  Stratego/XT 0.17. A language and toolset for program transformation , 2008, Sci. Comput. Program..

[7]  Eelco Visser,et al.  DSL Engineering - Designing, Implementing and Using Domain-Specific Languages , 2013 .

[8]  Krzysztof Czarnecki,et al.  Generative Programming , 2001, ECOOP Workshops.

[9]  Giuseppe Maggiore,et al.  High performance encapsulation and networking in Casanova 2 , 2017, Entertain. Comput..

[10]  Erwin Book,et al.  The CWIC/36O system, a compiler for writing and implementing compilers , 1970, SIGP.

[11]  Stephanie Weirich,et al.  Type Systems , 2014, Computing Handbook, 3rd ed..

[12]  Mikael Pettersson A Compiler for Natural Semantics , 1996, CC.

[13]  W. R. Campbell A Compiler Definition Facility Based on the Syntactic Macro , 1978, Comput. J..

[14]  Daniel Weise,et al.  Programmable syntax macros , 1993, PLDI '93.

[15]  Samson Abramsky,et al.  Handbook of logic in computer science. , 1992 .

[16]  Giuseppe Maggiore,et al.  Casanova: A Simple, High-Performance Language for Game Development , 2015, JCSG.

[17]  Enno Ohlebusch,et al.  Term Rewriting Systems , 2002 .

[18]  Samuel N. Kamin Research on Domain-specific Embedded Languages and Program Generators , 1997, US-Brazil Joint Workshops on the Formal Foundations of Software Systems.

[19]  Gordon D. Plotkin,et al.  A structural approach to operational semantics , 2004, J. Log. Algebraic Methods Program..

[20]  Anthony M. Sloane,et al.  Post-design domain-specific language embedding: a case study in the software engineering domain , 2002, Proceedings of the 35th Annual Hawaii International Conference on System Sciences.

[21]  Nicole Stender Template Metaprogramming for Haskell , 2014 .

[22]  Arie van Deursen,et al.  Domain-specific languages: an annotated bibliography , 2000, SIGP.