We will ow implement a modified version of the Entities DSL we implemented in Chapter 2, Creating Your First Xtext Language using Xbase. This will allow us to implement a more involved DSL where, inside entities, we can also write operations apart from attributes (this is inspired by the Xtext Domain-Model example).
As usual we create the Xtext project by performing the following steps:
Navigate to File | New | Project..., in the dialog go to the Xtext category and select Xtext Project.
In the next dialog you should specify the following names:
Project name:
org.example.xbase.entities
Name:
org.example.xbase.entities.Entities
Extensions:
xentities
Uncheck the option Create SDK feature project
The wizard will create three projects and it will open the grammar file Entities.xtext
.
Before running the MWE2 generator for the first time, you should modify the grammar so that it uses the Xbase
grammar:
grammar org.example.xbase.entities.Entities with...