Info | ||
---|---|---|
| ||
The two Xtext tutorials are stand-alone tutorials. You do not need to do the Xtext I tutorial in order to perform the Xtext II tutorial. Ask your supervisor which tutorial suits you best. |
This installment of our little series of tutorials will be all about Xtend, a programming language that looks very similar to Java, but which adds some very convenient features. Xtend code compiles to Java and and was developed using Xtext. In fact, once you gain experience working with Xtend you will probably appreciate the power of Xtext even more.
...
Exciting stuff, so let's begin
Table of Contents |
---|
Preliminaries
We have prepared a metamodel of our simple imperative programming language:
...
- Model files have the file extension ".imperative", while textual files have the file extension ".pseudo". When saving a model using EMF, the file extension of the file you save the model into will determine the output format.
- Each
IfStatement
requires both, a statement for the true case and a statement for the false case. You will not always need both. Use aBlock
statement as an empty statement when required.
Writing the Transformation
Now that you have familiarized yourself with the programming language's metamodel it's time to start working on your transformation:
...
Testing the Transformation
You will need a way to test the transformation, so we will have to make it available through the UI. Eclipse plug-ins often come with a separate UI plug-in that contains the UI contributions, with the base plug-in only offering the functionality itself. In our case, our base plug-in contains the transformation code, and the UI plug-in we will be creating next contains a menu contribution to make the transformation available.
...