FSM is a simple Finite State Machine DSL implementing a mealy machine semantics.
This implementation focuses on illustrating the hierarchy of languages: a base FSM with editor support considered as a legacy language (ie. as if it was developped by thirdparties) and an eXecutable Sequential FSM (XSFSM) with animation support built by extension of the FSM language.
General view: Concepts of the languages..
This language can be installed by importing the projects of this git repository in a GEMOC Studio. The language projects must be imported in the first workspace (language wokbench), then launch a new Eclipse instance from the first (ie. as a modeling workbench where the language is deployed) and then import the sample models. (see GEMOC documentation for more details about the language deployment process)
Alternatively, this language is part of the basic example of GEMOC and is directly available in the GEMOC Studio. Simply, go to File > New > Example... and use the wizards to install the LegacyFSM projects in the language workbench and modeling workbench.
Organization of the code
Main eclipse plugins:
- org.gemoc.sample.legacyfsm.fsm contains the definition of the FSM language using the Melange language.
- org.gemoc.sample.legacyfsm.fsm.design contains the graphical concrete syntax of FSM, using Sirius. It defines only the layer for edition.
- org.gemoc.sample.legacyfsm.fsm.k3dsa contains the operational semantics of FSM (ie. the interpreter), using the Kermeta3 language.
- org.gemoc.sample.legacyfsm.fsm.model contains the metamodel of FSM, using the Ecore language.
- org.gemoc.sample.legacyfsm.fsm.model.edit contains EMF edition support. It is used to customize the various views in Sirius and in the simulator (for example by providing custom icons in the various views)
- org.gemoc.sample.legacyfsm.fsm.model.editor contains EMF basic tree editor for FSM models.
- org.gemoc.sample.legacyfsm.xsfsm contains the definition of the XSFSM language using the Melange language. Basically, it inherits from FSM language and add the aspects defined in the k3dsa project.
- org.gemoc.sample.legacyfsm.xsfsm.design contains the graphical concrete syntax of XSFSM, using Sirius. It extends fsm.design editor by adding the layers used by the debug/animation.
- org.gemoc.sample.legacyfsm.xsfsm.trace contains the trace metamodel automatically generated from the semantics. It is used by the omniscient debugger to support StepBack instruction and to display an interactive timeline of the execution.
- org.gemoc.sample.legacyfsm.xsfsm.xsfsm contains the language runtime generated by Melange for XSFSM, ie. a new Ecore model that contains both static elements (from org.gemoc.sample.legacyfsm.fsm.model) and dynamic features (from org.gemoc.sample.legacyfsm.fsm.k3dsa).
Relation between FSM and XSFSM languages
The following figure presents an overview of the main artefacts in the projects:
- the base language fsm is built by fsm.melange from the fsm.ecore. As it use the legacy modifier (ie. it doesn't modifies the ecore definitions) the java classes from the ecore are directly reused as implementation for the fsm language;
- the aspects in fsm.k3dsa extends the base classes;
- the xsfsm.melange file defines the xsfsm language. It inherits from fsm and add the fsm.k3dsa aspects. This will generate the java implementation classes for the resulting xsfsm language.
Please note that for simplification of the diagram, the associations that doesn't represent a containment, have been represented as attributes rather than links.
Note about current limitations/issues
Currently, Melange doesn't automatically copy the .edit project from FSM to XSFSM. As a consequence, the customized icons defined in fsm.model.edit are not used in the debug views (Stack and variable views) and replaced by default icons.
Workaround: you can generate the edit project from XSFSM.genmodel and copy the icons from fsm.model.edit to xsfsm.xsfsm.edit.
The projects in modeling workbench contains some sample models.
you can run them from the modeling workbench by creating a launch configuration and using the GEMOC Sequential Engine. (see model details about launching the sequential engine in GEMOC Documentation).
Additionnal resources and related links
Please note that some of the document listed here may describe an early implementation of the language and may slightly differ from the current version.