GEMOC Studio extension for compiled DSLs
This repository contains a set of eclipse plugins to extend the GEMOC Studio with a new metaprogramming approach to define executable DSLs: the compilation to another executable language.
An example is also provided in the folder
examples/ad2petri, with a small activity diagrams DSL that compiles to Petri nets.
For now, no update site is provided for this extension. To install it, load the plugins (in the
plugins folder) in the workspace of the latest GEMOC Studio, and start a new eclipse application from there.
Summary of the architecture:
Given a chosen target executable language, also implemented using the GEMOC Studio Language Workbench, a compiled DSL is composed of:
- An abstract syntax, defined using Ecore, in a dedicated plugin and with code generated using a
- A compiler, which is a model transformation from the abstract syntax to the abstract syntax of the target language. It can be written with any language, as long as a Java class implementing the
org.gemoc.execution.feedbackengine.Compilerinterface is provided. In addition, this
Compilermust be exposed using the
- A definition of the state of conforming executable models, by defining aspects using the K3 language. These aspects must only contain dynamic data fields, and do not require operations.
- A feedback manager, which is a Java (or Java-compatible, eg. Xtend) class implementing the
FeedbackManagerinterface. It is responsible for translating target states and steps into source steps and states.
- A feedback configuration, which is a Java (or Java-compatible, eg. Xtend) class implementing the
FeedbackConfigurationinterface. It provides all the information required for feedback management: the feedback manager, the target language name and engine, the target configuration, This
FeedbackConfigurationmust be exposed using the
- A language definition, written using Melange, which assemble all parts of the language. Specifically for compiled DSLs, two annotations (using the Melange
annotationkeyword) must be used:
compiler, each pointing to the IDs of the extensions mentioned above.
- (optional) A concrete syntax, defined using Sirius, defining the graphical representation of both static and dynamic parts of the language.
Screenshot of an opened GEMOC Studio Language Workbench while implementing the
Model execution and debugging
Once a compiled DSL has been deployed in the GEMOC Studio Modeling Workbench, a model conforming to the DSL can be executed very similarly to any other model in GEMOC.
- Create a new launch configuration GEMOC Compiled Executable Model.
- Choose a model conforming to the abstract syntax of the source DSLs.
- Select the compiled DSL defined with Melange.
- To have automatic animation of th executed model, add an animator, ie. a Sirius
.airdfile with a graphical representation of the model.
- Start the execution, either in Run or in Debug. If in Debug mode, the debugger works similarly as for an interpreted DSL.
Screenshot of the launch configuration window to start execution a model from the
Screenshot of an opened GEMOC Studio Modeling Workbench while debugging a model from the