Skip to content
  Kermeta  

Kermeta tutorial

The FSM example

François Tanguy, Didier Vojtisek

Build date: 3-November-2006

Abstract

This tutorial is part of a serie of tutorials that explain step by step one of the aspect of Kermeta. This one is the master tutorial that will guide you through the different tutorials illustrating the explanation using the Finite State Machine example. After having read this tutorial (and dependent tutorials) you will know how to create a metamodel, add behavior and use it for simulation


Preface

Kermeta is a Domain Specific Language dedicated to metamodel engineering. It fills the gap let by MOF which defines only the structure of meta-models, by adding a way to specify static semantic (similar to OCL) and dynamic semantic (using operational semantic in the operation of the metamodel). Kermeta uses the object-oriented paradigm like Java or Eiffel. This document presents various aspects of the language, including the textual syntax, the metamodel (which can be viewed as the abstract syntax) and some more advanced features typically included in its framework.

[Important]Important
Kermeta is an evolving software and d espite that we put a lot of attention to this document, it may contain errors (more likely in the code samples). If you find any error or have some information that improves this document, please send it to us using the bug tracker in the forge: http://gforge.inria.fr/tracker/?group_id=32 or using the developer mailing list (kermeta-developers@lists.gforge.inria.fr) Last check: v0.3.1
[Tip]Tip
The most update version of this document is available on line from http://www.kermeta.org .

Chapter 1. Prerequisites

[Caution]Caution

KerMeta must be installed. If not, please read the "How to install KerMeta" tutorial.

Chapter 2. Introduction

This tutorial has been written to give an overview of many concepts used through KerMeta project creation. Following this tutorial should give you the knowledge : to create KerMeta project to create KerMeta meta models to add behavior to KerMeta meta models to execute a model To cover all this features, we decided to start from an existing example. It is a reference you should browse each time you are in difficulty because it is a complete KerMeta project. This example is about the finite state machine which acronym is FSM. This tutorial is divided in several dependent sub-tutorials. So it means that the reader should follow the speech structure. Anyway, if you want to jump some sections, in each sub-tutorial you will find a section named "Prerequisites" which specify the minimal background needed to understand the contents. List of sub tutorials : How to create a KerMeta meta model How to add behavior to a KerMeta meta model How to run a FSM model and to use run configurations? Firstly, a section is dedicated to the finite state machine we want to model. The next section explains how to load files of the example in your Eclipse workspace. You will have access to every files. The last three sections point on one sub tutorial (in the list order above)

Chapter 3. Finite State Machine Specifications

We want to represent IO/state machines. Inputs and outputs can be attached on each transition. To illustrate finite state machine, here is a simple example. This state machine recognizes the "hello!" motif and produces the "world!" motif. Here, we present this finite-state machine in a specific graphical syntax where states are represented as squares and transitions by arrow between squares. Input and outputs are present above transitions. Here, "h/w" says that we consume an "h" to produce a "w".

Figure 3.1. 

This simple state machine can be modeled and executed easily in Kermeta. See the following meta-model presented in a class diagram syntax.

Figure 3.2. 

Chapter 4. Loading the FSM example

[Caution]Caution

The FSM example is available from Eclipse only if KerMeta is already installed.

We start from the main Eclipse window.

Figure 4.1. 

Select : "File" > "New">> "Example...">>> A window appears. You are asked to choose a wizard for project creation. At the bottom of the list, you will find "Kermeta samples" item. Browse it and select "FSM Demo". The "Finish" button has been enabled. Click on it.

Figure 4.2. 

Thanks to the wizard creation project, a project named "fr.irisa.triskell.kermeta.samples.fsm.demo" appeared on the left side of Eclipse.

Figure 4.3. 

Chapter 5. How to create a KerMeta meta model ?

Please read "How to create a KerMeta meta model" tutorial.

Chapter 6. How to add behavior to a KerMeta meta model ?

Please read "How to add behavior to a metamodel" tutorial.

Chapter 7. How to run a FSM model and to use run configurations?

Please read "How to use run configuration" tutorial.