Xbase: Implementing Domain-Specific Languages for Java

by Sven Efftinge, Moritz Eysholdt, Jan Köhnlein, Sebastian Zarnekow, Robert von Massow, Wilhelm Hasselbring, Michael Hanus

Proc. of the 11th International Conference on Generative Programming and Component Engineering (GPCE'12), ACM Press, pp. 112-121, 2012
© ACM Press

Xtext is an open-source framework for implementing external, textual domain-spec ific languages (DSLs). So far, most DSLs implemented with Xtext and similar tools focus on structural a spects such as service specifications and entities. Because behavioral aspects are significantly more complicated to implement, they are often delegated to general-purpose programming languages. This approach int roduces complex integration patterns and the DSL's high level of abstraction is compromised. We present Xbase as part of Xtext, an expression language that can be reused via language inheritance in any DSL implementation based on Xtext. Xbase expression s provide both control structures and program expressions in a uniform way. Xbase is statically typed and tightly integrated with the Java type system. Lang uages extending Xbase inherit the syntax of a Java-like expression language as well as language infrastructure components , including a parser, an unparser, a linker, a compiler and an interpreter. Furt hermore, the framework provides integration into the Eclipse IDE including debug and refactoring support. The application of Xbase is presented by means of a domain model language which serves as a tutorial example and by the implementation of the programming langua ge Xtend. Xtend is a functional and object-oriented general purpose language for the Java Virtual Machine (JVM). It is built on top of Xbase which is the reusable express ion language that is the foundation of Xtend.

Preprint (PDF) BibTeX-Entry Online