Eclipse Creating Xtext Project

This is one of a sequence of pages that I have wriiten about Xtext which start here.

Create Xtext Project

First install Eclipse and intall Xtext into Eclipse if not already installed.

Then start Eclipse and click on menu:

File -> New -> Other

Which gives this dialog:

Select Xtext Project and click on next.

xtext new project

We then get a screen where we can enter the project name and language details. In this case:

Project Name

Extensions: spad

We then click on Finish:

xtext new project
This gives us a default project like this: xtext new project

Add Our Own Code

We can then replace the default grammar and generator with our own code. The grammar is in the following file:


which can be replaced with the code at github here.

and the generator is in the following file:


which can be replaced with the code at github here.

Generate Editor Code

At this stage not all the files and dependancies are availible to create these we need to run GenerateEditor.mwe2 in com.euclideanspace.spad -> src -> com.euclideanspace.spad, to do this follow the procedure below.

If we want a wizard, for our laguage, to create a new project of the appopriate type then uncomment the project wizard fragment in the GenerateEditor.mwe2 file.

I changed the generating project name from "${projectName}" to "casl${projectName}" to

create new wizard

We then right click on GenerateEditor.mwe2 in com.euclideanspace.spad -> src -> com.euclideanspace.spad

and select the option RunAs mwe2Workflow

xtext generator

There may be a request in the console to download ANTLR 3

and select the option RunAs mwe2Workflow

I entered y <cr>

We then wait for the following messages in the Console:

and select the option RunAs mwe2Workflow

Running UI

Right click on /com.euclideanspace.spad/plugin.xml_gen and select Run As -> Eclipse Application. This starts up a second version of eclipse to run our app.

In this new eclipse we:


A message box asks us if we want to add the Xtext nature, say yes to this.

We can then add an SPAD file (pressing cntl-space gives auto complete)


metadata block
see also:


Correspondence about this page

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2022 Martin John Baker - All rights reserved - privacy policy.