Kermeta
Encyclopedia
History
The Kermeta language was initiated by Franck Fleurey in 2005 within the Triskell team of IRISAIRISA
The Institut de recherche en informatique et systèmes aléatoires is a joint computer science research center of CNRS, University of Rennes 1, INSA and INRIA, located in Rennes in Brittany...
(gathering researchers of the INRIA, CNRS, INSA and the University of Rennes
University of Rennes
The University of Rennes was a French university located in the city of Rennes. It was established by the union of the 3 faculties of the city in 1885. In 1969, it was divided in two new universities:* the University of Rennes 1...
1).
The Kermeta language borrows concepts from languages such MOF
Meta-Object Facility
The Meta-Object Facility is an Object Management Group standard for model-driven engineering. The official reference page may be found at OMG's website.- Overview :...
, OCL
Object Constraint Language
The Object Constraint Language is a declarative language for describing rules that apply to Unified Modeling Language models developed at IBM and now part of the UML standard. Initially, OCL was only a formal specification language extension to UML. OCL may now be used with any Meta-Object...
and QVT
QVT
QVT is a standard set of languages for model transformation defined by the Object Management Group .- Overview :...
, but also from BasicMTL, a model transformation language implemented in 2004 in the Triskell team by D. Vojtisek and F. Fondement. It is also inspired by the previous experience on MTL, the first transformation language created by Triskell, and by the Xion action language for UML
Unified Modeling Language
Unified Modeling Language is a standardized general-purpose modeling language in the field of object-oriented software engineering. The standard is managed, and was created, by the Object Management Group...
.
The name Kermeta is an abbreviation for "Kernel Metamodeling" and reflects the fact that the language is conceived as a core for (meta-)modeling. The Breton language
Breton language
Breton is a Celtic language spoken in Brittany , France. Breton is a Brythonic language, descended from the Celtic British language brought from Great Britain to Armorica by migrating Britons during the Early Middle Ages. Like the other Brythonic languages, Welsh and Cornish, it is classified as...
consonance of this name is an intentional reflection of the Triskell team's location in Britanny.
Kermeta, and its execution platform under Eclipse
Eclipse (software)
Eclipse is a multi-language software development environment comprising an integrated development environment and an extensible plug-in system...
is currently available under its version 1.4.1. It is open-source, under the Eclipse Public License
Eclipse Public License
The Eclipse Public License is an open source software license used by the Eclipse Foundation for its software. It replaces the Common Public License and removes certain terms relating to litigations related to patents....
.
Philosophy
Kermeta is a modeling and aspect oriented programming language. Its underlying metamodel conforms to the EMOF standard. It is designed to write programs which are also models, to write transformations of models (programs that transform a model into another), to write constraints on these models, and to execute them 1). The goal of this model approach is to bring an additional level of abstraction on top of the "object" level and thus to see a given system like a set of concepts (and instances of concepts) that form an explicitly coherent whole, which one will call a model.Kermeta thus brings:
- all the concepts of EMOF used for the specifications of a model.
- a real concept of model, more precisely of model type (Jim Steel).
- a concrete syntax that fits well to model and metamodel writing.
- two paradigms: the object, and the model.
- a bridge towards the Eclipse ECore formalism
Characteristics
The main characteristics of the Kermeta language are :- imperativeImperative programmingIn computer science, imperative programming is a programming paradigm that describes computation in terms of statements that change a program state...
: traditional structures of control - object-oriented: multiple inheritance, late binding
- model-oriented: first-class concepts of associations and composition
- aspect-oriented: integrate a simple but powerful weaver for simple meta-modeling tasks. Arbitrary complex weaving is achieved using a dedicated composer written in Kermeta. This allows to extend existing metamodel. Especially in order to add behavior to them by weaving behavioral semanticFormal semantics of programming languagesIn programming language theory, semantics is the field concerned with the rigorous mathematical study of the meaning of programming languages and models of computation...
(operational or translational). - design by contractDesign by contractDesign by contract , also known as programming by contract and design-by-contract programming, is an approach to designing computer software...
: operations support pre and post conditions, classes use invariants. - functionalFunctional programmingIn computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state...
: functions and first class lambda-expressions - statically typed: genericity for the classes and the operations, function types...
- complete introspectionType introspectionIn computing, type introspection is a capability of some object-oriented programming languages to determine the type of an object at runtime. This is a notable capability of the Objective-C language, and is a common feature in any language that allows object classes to be manipulated as first-class...
: the complete model of the program is available during execution.
Syntax
The curious reader will find further information on the Kermeta website.Example
package fsm;
require kermeta
using kermeta::standard
class FSM
{
attribute ownedState : set State[0..*]#owningFSM
reference initialState : State[1..1]
reference currentState : State
/**
* Print the FSM on the standard output
*/
operation printFSM is do
self.ownedState.each
{ s |
stdio.writeln("State : " + s.name)
s.outgoingTransition.each
{ t |
stdio.writeln(" Transition : " + t.source.name +
"-(" + t.input + "/" + t.output + ")->" + t.target.name)
}
}
end
}
class State {
attribute name : String
reference owningFSM : FSM#ownedState
attribute outgoingTransition : set Transition[0..*]#source
reference incomingTransition : set Transition[0..*]#target
operation step(c : String) : String is do
// Get the valid transitions
var validTransitions : Collection
validTransitions := outgoingTransition.select { t | t.input.equals(c) }
// Check if there is one and only one valid transition
if validTransitions.empty then raise "No Transition!" end
if validTransitions.size > 1 then raise "Non Determinism" end
// fire the transition
result := validTransitions.one.fire
end
}
class Transition
{
reference source : State[1..1]#outgoingTransition
reference target : State[1..1]#incomingTransition
attribute output : String
attribute input : String
operation fire : String is do
// update FSM current state
source.owningFSM.currentState := target
result := output
end
}
See also
- Model Driven Engineering
- Domain Specific Language
- Domain Specific Modelling
- Model-Based TestingModel-based testingModel-based testing is the application of Model based design for designing and optionally executing the necessary artifacts to perform software testing. Models can be used to represent the desired behavior of the System Under Test , or to represent the desired testing strategies and testing...
- Metamodeling
- OCLOCLThe initialism OCL can have several meanings, depending on context:*OCl−, the hypochlorite ion, in chemistry*Object Constraint Language*Ocean Climate Laboratory *Ocean County Library*Old Colony League, a high school sports league in Massachusetts...
- Model Transformation LanguageModel Transformation LanguageA model transformation language in systems and software engineering is a language for model transformation.- Overview :The notion of model transformation is of central importance to information technology. A software system may be seen as a set of information transformations...
- Meta-Object FacilityMeta-Object FacilityThe Meta-Object Facility is an Object Management Group standard for model-driven engineering. The official reference page may be found at OMG's website.- Overview :...