Join us on:

T1. Crafting External Domain Specific Languages with Xtext

Peter Friese, itemis AG

Peter Friese is a software architect with itemis in Germany and Canada. He is a committer for the open source projects TMF Xtext, openArchitectureWare, Eclipse and FindBugs. As a software engineer and software architect, Peter has worked on a variety of industry projects in different domains such as banking, aerospace and transport. Peter is the author of various articles on the topics of Eclipse, Spring, and model-driven software development. He is a regular speaker at various software conferences.

Moritz Eysholdt, itemis AG

Moritz Eysholdt is a developer and software architect at itemis AG in northern Germany where he develops tools and frameworks related to model-driven software development. Current fields of activity are textual DSLs, patching models and co-adapting models to their evolving meta models. Moritz gives talks on this topics at software conferences and is a committer on the Eclipse project TMF Xtext, EMF Compare and openArchitectureWare.

Domain Specific Languages (DSLs) are becoming more and more popular, allowing developers to express their intent more precisely and with less syntactic noise. DSLs can be built on top of a host language (like Java or Ruby), which are referred to as "internal DSLs". External DSLs are far more flexible in terms of language design: you can define any desired grammar, you can define domain specific constraints and error messages, and you can process the DSL in a concise manner, because it can either be interpreted or transformed into the code of any language by a generator.

TMF Xtext is a framework for developing textual domain-specific languages. Given an EBNF-style grammar, Xtext automatically generates an Ecore meta model and a rich-featured, fully configurable text-based DSL editor including features such as syntax highlighting, hyperlinked reference navigation, reference look-up, code completion, formatting, an outline, and so on. The default implementation can easily be customized.

In this hands-on tutorial, we will first explain the core concepts of Xtext. Participants will then learn how to write their own Xtext grammar and derive an Eclipse-based tool chain from this grammar, including a fully-fledged editor and a code generator.


Tutorial participants will learn:

  • the differences between internal and external DSLs
  • how to implement/the needed concepts for external textual DSL with Xtext
    • defining a concrete syntax for a meta model using a grammar / deriving a meta model from a grammar = Parser rules, terminal rules, data type tules, enum rules, actions, etc.
    • linking cross references while respecting different scopes for identifiers
    • defining a formatter (beautifier) for a DSL
    • inheriting languages
    • scaling languages by using an indexing service for resolving inter-file cross references
    • serializing models to textual concrete syntax
  • how to customize an Xtext-based DSL editor.
    • syntax based code coloring
    • in-file and inter-file navigation
    • outline view
    • list references
    • code completion as you type
    • real-time feedback for violated constraints
  • how to process DSL files
    • constraint-based validation
    • MDSD-based code generation

Some (introductory and reference-style) slides. Most of the tutorial will be hands on. Attendees NEED to bring their notebooks (must be able to run Eclipse, 2GB RAM required, 1GB hard disk required). Required software will be supplied by the presenters on USB sticks for Windows, Mac OS X and Linux.

Audience: Practitioners
Please email any questions to . This e-mail address is being protected from spambots. You need JavaScript enabled to view it