These tutorials are no longer maintained. Some of these tutorials continue to be maintained for the lecture Advanced Concepts in Software Engineering.
This tutorial briefly explains the steps needed to create a new DSL project with Xtext.
- Select File > New > Project…, choose Xtext > Xtext Project.
- Choose project name, e.g.,
de.wwu.pi.mdsd.customerDsl
. - Choose name of language, e.g.,
de.wwu.pi.mdsd.customerDsl.CustomerDsl
, and a file extension that model files in the language will use, e.g.,cdsl
. - A click on Finish will create 4 projects, most importantly the main project (de.wwu.pi.mdsd.customerDsl). It contains the Xtext grammar (CustomerDsl.xtext) and a workflow file for generating the infrastructure from the language description (GenerateCustomerDsl.mwe2).
- Implement your language in CustomerDsl.xtext.
-
Generate the language and infrastructure, for example by selecting the corresponding workflow file and choose (“Run As > MWE2 Workflow”) from the dropdown menu next to the “Run” icon in the toolbar.
This has to be done every time after making changes to the grammar.
- When asked “Do you agree to download …”, type
y
in the console of Eclipse and hit enter. -
To test your language and its editor, start a new Eclipse instance (“Launch Runtime Eclipse” from the Run dropdown menu).
“Launch Runtime Eclipse” from the Run dropdown menu
- In the new instance, create a new general project. Therein, create a new file that has the extension specified in step 3 (e.g., test.cdsl). Click Yes when asked if you want to add the Xtext nature to the project.
- Start typing …
For further details, please refer to the Xtext documentation. If you have any questions, please direct them to the Learnweb discussion forum.