Chapter 2. Creating Your First Xtext Language

In this chapter, we will develop a DSL with Xtext and learn how the Xtext grammar language works. We will see the typical development workflow of programming with Xtext when we modify the grammar of the DSL. The chapter will also provide a small introduction to EMF (Eclipse Modeling Framework) a framework that Xtext relies on to build the AST of a program.

This chapter will cover the following topics:

  • A DSL for entities
  • The Xtext generator
  • The Eclipse Modeling Framework
  • Improvements to the DSL

A DSL for entities

We will now implement a simple DSL to model entities, which can be seen as simple Java classes. Each entity can have a super type entity (you can think of it as a Java superclass) and some attributes ...

Get Implementing Domain-Specific Languages with Xtext and Xtend - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.