Kermeta is a modeling and programming language for metamodel engineering. It fills the gap between MOF , which defines only the metamodel structure, and the practical needs of programming, adding tools for defining static semantics (like a domain-specific programming language ) and dynamic semantics (using the operational semantics of the metamodel). [1] Kermeta uses an object-oriented paradigm, like Java or Eiffel .
Content
History
Kermeta language was initiated by Frank Floyry in 2005 as part of the Triskell project of the French Institute of Computer Science and Systems Research IRISA in Rennes (Brittany).
Kermeta borrows concepts from languages ββsuch as MOF , OCL, and QVT , but also from BasicMTL, a model transformation language that was implemented in 2004 by Triskell D.Vojtisek and F.Fondement. He is also inspired by previous experiences with MTL, the first transformation language created by the Triskell project, and the action description language for the UML βXionβ.
The name Kermeta is short for "Kernel Metamodeling" and reflects the fact that the language is conceived as the core for (meta) modeling.
Kermeta, and its executable platform under Eclipse , is currently available in version 2.0.4 [2] released in 2012. This is an open source product under the Eclipse Public License .
Philosophy
Kermeta is a modeling and aspect-oriented programming language . The metamodel underlying it complies with the EMOF version of the MOF standard. It is designed to write programs that are also models and perform transformations on models. The purpose of this approach is to introduce an additional level of abstraction on top of the "object" level, and see this system as a set of concepts (and instances of these concepts), forming a single whole, called a model.
Kermeta thus brings:
- All concepts of the MOF version of EMOF are used to specify models.
- A specific syntax that is well suited for writing models and metamodels.
- Two paradigms: object and model.
- The bridge to another implementation of the metamodel approach is the Eclipse Modeling Framework .
Features
Key features of Kermeta language:
- imperative : traditional governance structures
- object orientation : multiple inheritance, late binding
- model orientation: first-class concepts of association and composition
- aspect-orientation : integrated a simple but powerful mechanism for simple meta-modeling tasks. It is especially convenient for adding behavioral semantics to the model - operational or translational
- contract programming : support for operations before and after the condition, classes use invariants.
- Functional programming : first-class functions and lambda expressions
- static typing: typical for classes and operations, types of functions ...
- full introspection : the entire program model is available at runtime.
Syntax
An inquisitive reader will find more information on Kermeta .
Example (Kermeta 1.4)
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<Transition> 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 }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<Transition> 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 Development
- Domain Oriented Programming Language
- Domain Specific Modeling
- Model Based Testing
- Metamodeling
- Object Constraint Language
- Model Transformation Language
- Meta-object facility
Notes
- Weaving Executability into Object-Oriented Meta-Languages Pierre-Alain Muller, Franck Fleurey, and Jean-Marc JΓ©zΓ©quel. In S. Kent L. Briand, editor, Proceedings of MODELS / UML'2005, LNCS, Montego Bay, Jamaica, October 2005. Springer.
- β Language Documentation Archived on September 27, 2013.
- β Vojtisek, Didier Version 2.0.4 is released! . Date of treatment December 3, 2012.