Showing items from Eclipse

Xtext Tip: How to use fully qualified names in your language

Xtext allows to easily add support for fully qualified names in your language. The full code for this example can be found here.

The basic block language

To illustrate this feature I will use a simple language to represent blocks. Each block has a name and can contain three members:

  • Fields, which are basically a name,
  • Blocks, which are blocks contained in another block
  • Aliases, which allow to give another name to another member

This is an example of our block language:

Continue Reading

Xtext Tip: Use Java instead of Xtend

Xtend is a wonderful language. It is specially practical when traversing ASTs and it is the best option to generate code. However, it is “is no longer the Java 17 of today”, as Christian Dietrich (one of Xtext maintainers) put it in this thread.

Hence, the recommended best practices for Xtend as of today are:

  • Use Xtend as a thin code generation layer.
  • Use Java for the rest of the logic.
  • Migrate Xtend code to Java whenever possible.
  • Set the code generators in the MWE file to generate Java stubs instead of Xtend (newer versions of Xtext do this by default.)

The configurations in the MWE file are the following:

Continue Reading

How DSLs can remove the bottleneck from the development team

In his book, The Goal, Eliyahu M. Goldratt presents a way to optimize a plant using his Theory of Constraints. This book lays out the concepts that later will inspire the agile methodologies, which is applying the Theory of Constraints to the development of software. The book The Phoenix Project relates the concepts explained in The Goal with IT and software development.

The gist of the approaches in these books is the following. To optimize a system (for example, a development organization) we must:

Continue Reading

MDE Tools: EMF

In my last post I informally introduced the notion of metamodel and mentioned that one of the tools that is used around them is Eclipse Modelling Framework (EMF). In this post, I am presenting EMF because it is at the heart of a lot of other MDE technologies.

What Is EMF?

From EMF website we have:

The EMF project is a modeling framework and code generation facility for building tools and other applications based on a structured data model. From a model specification described in XMI, EMF provides tools and runtime support to produce a set of Java classes for the model, along with a set of adapter classes that enable viewing and command-based editing of the model, and a basic editor.

Continue Reading

Basic concepts: Metamodeling

This is an informal introduction to metamodeling. The target audience for this post are developers that find themselves working with metamodeling tools but have never been introduced to them and need a basic understanding to finish the task at hand.

What Is a Metamodel?

Let us start with a simple example, your software needs to represent arithmetic expression additions. If you are familiar with UML, we can represent that using the following diagram:

Continue Reading