Erwan Bousse
Nantes University
Eclipse GEMOC Studio training
Erwan Bousse
Nantes University
23/02/2022
Since 2018, I am Associate Professor at Nantes University teaching software engineering (including MDE and SLE) at the Department of Computer Science
I am also member of the NaoMod research group in the LS2N lab, with different research interests:
Software Language Engineering (SLE)
Model Driven Engineering (MDE)
Domain-Specific Languages (DSLs)
Model execution and simulation
Debugging and testing of models
…
Small introduction about Software Language Engineering (SLE)
Presentation of the Eclipse GEMOC Studio
Step-by-step presentation of how to make a very small DSL (Finite State Machine) with the Eclipse GEMOC Studio
Creation of a Character Simulation DSL from scratch using the GEMOC Studio
You say MDE? I hear SLE
Cyber physical systems, internet of things, massively multiplayer online games, artificial intelligence, …
complexity everywhere!
involving multiple stakeholders and concerns from heterogeneous domains
Increasing use of software, aka. software−intensive systems
Separation of concerns through the use of models
defined using domain specific languages (DSLs)
each representing a particular aspect of a system
Composition of all often heterogeneous models
Implementation (or generation) of the final resulting system
Well scoped language, often small
Targets particular tasks in a certain domain
Relies on dedicated notations (textual or graphical)
Less redundancy
Better separation of concerns
Accessible for domain experts
An SLE research playground
Open-source Eclipse-based workbench atop the Eclipse Modeling Framework (EMF), in two parts:
language workbench: used by language designers to build and compose new executable DSLs,
modeling workbench: used by domain designers to create, execute and coordinate models conforming to executable DSLs.
Handled by the GEMOC initiative, an informal group with partners from both the academia and the industry
Now also an official research consortium of the Eclipse foundation
Research platform to experiment with SLE research proof-of-concepts / prototypes, and to integrate them together
The Eclipse GEMOC Studio is not an industry-ready tool, and will never be one!
Illustrated with a Finite State Machine DSL
We want to be able to create and execute finite state machine (FSM) models
We consider FSMs that are able to parse an input string, and produce an output string, when firing transitions
Here if we give btt
as input string, it first goes to Yellow
, then Red
, then Green
again.
The abstract syntax must be defined using the Ecore metamodeling language
Each class of the metamodel is a concept of the DSL
Essentially, using the DSL means creating and/or editing a model conforming the the metamodel defining the abstract syntax
Note | Important to generate the code from the metamodel, so that we can create and manipulate model elements from the semantics later on |
The execution semantics of a DSL must comprise two parts:
The definition of the runtime state of a model of the DSL under execution
The definition of the interpreter, which executes a model of the DSL by modifying the runtime state
We use Ecore to define the runtime state, in the same file as the abstract syntax
We can either add new references directly in existing classes (we do that in the FSM example), or define new more separated classes (we do that in the tutorial later)
The Eclipse GEMOC Studio provides different ways to define the interpreter, both "official" ones (K3, Moccml+K3, ALE) and third-party ones (Henshin, xMOF).
We will focus for now on K3, an aspect-oriented language to "weave" the semantics inside each concept of the language. K3 is a set of annotations for the Xtend programming language:
The @Aspect
annotation is used to define operations in existing classes − here we will use this to add operations in classes of our abstract syntax
The @Step
annotation is used to declare that a given execution method produces an observable execution step (required for the GEMOC debugger to work)
The @InitializeMethod
is used to declare what is the initialiation method of the interpreter, ie. how is the first execution state constructed
The @Main
operation is used to declare what is the entry point of the interepter
The graphical concrete syntax can be defined using the Sirius language from Obeo
In a nutshell, we must define how each of our concept is graphically represented in an editor (eg. a State
is a rounded rectangle, an initial State
is orange, a Transition
is an arrow, etc.)
Using the GEMOC Studio, we can easily extend the Sirius graphical concrete syntax to also display extra information during the execution of a model. This is what we call model animation.
This is achieved by the definition of a Debug layer in the Sirius representation.
We can now try our DSL by loading it into a new Eclipse instance!
When loaded in this instance, this DSL will directly benefit from all the existing generic tools of the GEMOC Studio (eg. debugger and animator).
Now move here for the practical training: