Let’s focus on the language syntax. Ie. how the models will appears.
This is done by defining an abstract syntax and one or several concrete syntaxes.
Even if some tool may hide either the concrete syntax or abstract syntax details, in GEMOC we consider the general case where syntaxes are distinct entities.
The GEMOC project will be used to drive the creation and assemble the language artefacts/projects.
The xDSML Project is the core project of languages created using the GEMOC Studio. It has one main purposes:
In the GEMOC Studio, go to: File > New > Project… > New GEMOC Language Project. This will create a new xDSML Project in your workspace.
The .melange file is the main element of the xDSML Project.
From the information contained in this file, the project generates additional code that is used by the Execution Engine during the execution of models conforming to the xDSML (see Part II, “Modeling workbench User Guide
”).
The GEMOC Language Workbench provides an xDSML perspective. It is available in the menu Window > Open Perspective > Other.
This perspective eases the creation of a new xDSML project. In the menu File > New, you have direct access to

On a right click on an xDSML project you have access to this menu containing theses commands:

On a right click on a .melange file you have access to this menu containing theses commands:

Melange is a Language designing tool. Through a .melange file you can define a Language as an assembly of abstract syntaxes with operational semantics and also as a composition of Languages. To do so, Melange is provided with a textual Languages editor.
A .melange file start with
package your.language.namespace
and contains a list of Language definitions starting with the keyword language.
a basic Language.
package org.eclipse.gemoc.sample.tfsm.xdsml
language Tfsm {
/*
* Declare abstract syntax
*/
syntax "platform:/resource/org.eclipse.gemoc.sample.tfsm.plaink3.model/model/tfsm.ecore"
/*
* Set name of the ModelType (ie: the type of this language)
*/
exactType TfsmMT
}
A Language definition accept theses keywords:
Your xDSML project need a dependency to your DSA project. Check the Require-Bundle section in the MANIFEST.MF if the Melange editor can’t see the used Aspect.
a Language with semantic.
package org.eclipse.gemoc.sample.tfsm.xdsml
language Tfsm {
/*
* Declare abstract syntax
*/
syntax "platform:/resource/org.eclipse.gemoc.sample.tfsm.plaink3.model/model/tfsm.ecore"
/*
* Declare DSA
*/
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.TFSMAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.TFSMVisitorAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.FSMEventAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.FSMClockAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.FSMClockVisitorAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.StateAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.StateVisitorAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.TransitionAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.TransitionVisitorAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.GuardVisitorAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.TemporalGuardVisitorAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.EventGuardVisitorAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.TimedSystemAspect
with org.eclipse.gemoc.sample.tfsm.plaink3.dsa.TimedSystemVisitorAspect
/*
* Set name of the ModelType (ie: the type of this language)
*/
exactType TfsmMT
}
You can press Ctrl+Space to have a content assist in the Melange editor.
In language { … }

Display the list of available .ecore in your workspace and update syntax with the path to the selection.

Display the list of accessible Java classes from your project dependencies. K3 Aspects are displayed first.

Display the list of available .ecl in your workspace and update ecl with the path to the selection.

The outline view is available when you open a .melange file. It gives an overview of the file content.

The plugin.xml file is the link between the Languages and the Modelling Workbench. It is mainly composed of two extension points:
Gemoc extension points declare Languages availables in the Modelling Workbench. It also give the class able to load models for each Language.
GEMOC language.
<extension point="org.eclipse.gemoc.gemoc_language_workbench.sequential.xdsml"> <XDSML_Definition modelLoader_class="org.eclipse.gemoc.executionframework.extensions.sirius.modelloader.DefaultModelLoader" name="org.eclipse.gemoc.sample.tfsm.xdsml.Tfsm" xdsmlFilePath="/org.eclipse.gemoc.sample.tfsm.plaink3.xdsml/bin/org/eclipse/gemoc/sample/tfsm/xdsml/Main.melange" >
Melange extension points declare semantic of Languages as list of Domain model classes associated to their K3 Aspects. It also gives the available entry points for the execution, which are the Aspects methods tagged with @Main.
Melange Language.
<extension point="fr.inria.diverse.melange.language"> <language aspects="FSMClock:org.eclipse.gemoc.sample.tfsm.plaink3.dsa.FSMClockAspect,org.eclipse.gemoc.sample.tfsm.plaink3.dsa.FSMClockVisitorAspect;..." entryPoints="org.eclipse.gemoc.sample.tfsm.plaink3.dsa.TimedSystemAspect.main(org.eclipse.gemoc.sample.tfsm_plaink3.TimedSystem)" exactType="org.eclipse.gemoc.sample.tfsm.xdsml.TfsmMT" id="org.eclipse.gemoc.sample.tfsm.xdsml.Tfsm" uri="http://tfsmmt/" >
<XDSML_Definition name> have to be equal to <language id>
The Domain Model Project specifies the concepts of the domain at hand and the structural relations between the concepts.
The GEMOC Studio relies on the Eclipse Modeling Framework for its Domain Model Projects. See the EMF website for more information on how to create an EMF project in Eclipse. The Domain Model is materialized as an Ecore metamodel.
When your EMF Project is done, connect your xDSML Project to it by specifying in the .melange file the path to your Ecore metamodel thanks the keyword syntax. See Section 2.1.7, “Melange editor” for more informations about Melange keywords and the content assist.
An xDSML can support different concrete syntaxes. Most EMF-based editors should work with GEMOC, however the GEMOC Studio provides additional support for some specific editors. Thus, we recommend using: an EMF arborescent editor, an Xtext editor, and/or a Sirius editor.
See the Xtext website.
If you want to create a graphical concrete syntax you can use Sirius. The Sirius documentation provides information for Sirius Specifier Manual.
EMF provides several services, as seen in Section 2.2, “Define a Domain Model Project” , EMf allows generating many artifacts. In addition to generate the java code for the metamodel and provide a reflective tree editor, EMF allows to generate a customizable Tree Editor.
On the .genmodel right click on the root element then Generate Edit Code and Generate Editor Code.
Some very easy customizations can be done in the .edit project:
.gif files in the icons folder.*ItemProvider.java classes.Table Table 2.1, “Example of customization of icons on Timed Finite State Machine tree editor.” illustrates the value of adding dedicated icons for a given domain.
When modifing java code in the generated projects, do not forget to change the comment from generated to generated NOT, so the genmodel generator will keep your changes.
Providing custom icons and labels are not dedicated to the Tree Editor only. When possible, these elements will also be used to improve the Outline, the Debug Stack or the Variable views (see sections Section 9.3.7, “Debug View”, Section 9.3.8, “Variable View”, Section 9.2.6, “Debug View” and Section 9.2.7, “Variable View”).
More complex images can be obtained by implementing the getImage method in the *ItemProvider.java classes. For example by using overlay or switching the image depending on one of its attribute in order to represent more precisely the content of model element.
[4] asciidoc source of this page: https://github.com/eclipse/gemoc-studio/tree/master/docs/org.eclipse.gemoc.studio.doc/src/main/asciidoc/userguide/lw_CreateLanguage.asciidoc.
[5] asciidoc source of this page: https://github.com/eclipse/gemoc-studio/tree/master/docs/org.eclipse.gemoc.studio.doc/src/main/asciidoc/userguide/lw_CreateGEMOCProject_headContent.asciidoc.