O'Reilly logo

Implementing Domain-Specific Languages with Xtext and Xtend by Lorenzo Bettini

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Expressions DSL with Xbase

For the first example of the use of Xbase, we implement a DSL similar to the Expressions DSL that we presented in Chapter 8, An Expression Language, which we call as Xbase Expressions DSL; this DSL is inspired by the Scripting Language DSL of the 7 languages examples.

Creating the project

First of all, we create the project:

  1. Navigate to File | New | Project..., in the dialog navigate to the Xtext category and select Xtext Project.
  2. In the next dialog you should specify the following names:
    • Project name: org.example.xbase.expressions
    • Name: org.example.xbase.expressions.Expressions
    • Extensions: xexpressions
    • Uncheck the option Create SDK feature project

The wizard will create three projects and it will open the grammar file ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required