Kermeta language

Reference manual

Zoé Drey

Cyril Faucher

Franck Fleurey

Vincent Mahé

Didier Vojtisek

Build : 2.1.1-SNAPSHOT 20130925-1232

Abstract

This manual presents the various aspects of the Kermeta language. This is the reference manual for anybody who want to use Kermeta.


Table of Contents

Preface
1. Introduction to Kermeta
1.1. Presentation
1.2. Action language : An imperative syntax
1.2.1. First Program
1.2.2. Classic features
1.2.3. Corresponding sections in the Reference chapter
1.3. Action language : An object-oriented language
1.3.1. Corresponding sections in the Reference chapter
1.4. Action Language : A model-oriented language
1.4.1. Associations : toward a first concrete example of a Kermeta model
1.4.2. Loading an existing model
1.4.3. Navigation in a model
1.4.4. Model type
1.4.5. Kermeta model reflexively available
1.4.6. Corresponding sections in the Reference chapter
1.5. Mashup of metalanguages
1.5.1. Model static introduction
1.5.2. Model element static introduction : Aspect-oriented language
1.6. Some "advanced" features
1.6.1. Functions in Kermeta
1.6.2. Other advanced features
2. Reference
2.1. Comments
2.1.1. Simple and multi-line text comments
2.1.2. Linked comments
2.2. Escaping reserved keywords
2.3. Operators
2.4. Statements : block, condition, loop
2.4.1. Block statement
2.4.2. Conditional statement
2.4.3. Loop Statement
2.5. File dependency : structuring code
2.5.1. Require
2.5.2. Accepted require content
2.5.3. Supported protocols
2.5.4. Organizing code
2.6. Using Variables
2.7. Basic types
2.7.1. Primitive types
2.7.2. Enumeration types
2.7.3. Local datatype using "alias"
2.8. Classes and methods
2.8.1. Classes
2.8.2. Defining operations
2.8.3. Initializing classes
2.8.4. Rationale
2.9. Inheritance
2.9.1. Using simple inheritance
2.9.2. Cast
2.9.3. Using multiple inheritance
2.9.4. Overriding behavior with methods
2.9.5. Some limitations
2.10. Genericity
2.10.1. Generic classes
2.10.2. Generic operations
2.10.3. Type usable with genericity
2.11. Exception handling
2.12. Loading and saving models
2.12.1. Prepare a model
2.12.2. Load a model from an EMF Resource
2.12.3. Save a model into an EMF Resource
2.13. Packages
2.14. using keyword syntactic sugar
2.15. Collections
2.15.1. Definition and initialization
2.15.2. Some existing useful functions
2.16. Class properties
2.16.1. Attributes (attribute) , references (reference)
2.16.2. properties modifiers
2.16.3. Association using opposite properties
2.16.4. Derived properties (property)
2.16.5. How to access and control the properties in Kermeta
2.16.6. Assignment behavior for attribute (and reference)
2.17. Singleton class
2.18. Objects comparison
2.18.1. equals method
2.18.2. Comparison for Primitive Types
2.18.3. Collection comparison
2.19. Lambda Expressions and functions
2.19.1. Syntax
2.19.2. Some existing useful functions
2.19.3. Defining new functions in a class
2.19.4. Defining lambda expression variables
2.19.5. Useful patterns that use lambda
2.20. Dynamic evaluation of Kermeta expressions
2.21. Design by contract (pre, post, inv contraints)
2.21.1. Writing a contract
2.21.2. Checking your constraints
2.22. Weaving Kermeta code
2.22.1. Textual syntax for merging
2.22.2. Example 1: Simple Class merge
2.22.3. Example 2: merge with feature redefinition
2.22.4. Example 3: merge with overload of operation from ecore genmodel
2.22.5. Aspect and inheritance
2.22.6. Aspect and abstract
2.22.7. Aspect without common base
2.23. Model type
2.23.1. Definition of a model type
2.23.2. Using Model types variables
2.23.3. Model type serialisation
2.23.4. Model type conformance
2.23.5. Using Model types in generic classes/operations
2.23.6. A more complex example of conformance : FSM variants
2.24. Using existing java code in Kermeta
2.24.1. Using extern to call java code
2.24.2. Requiring jar file to call java code
2.25. Cloning objects
3. Kermeta Metamodel
3.1. Architecture
3.2. Structure package
3.2.1. NamedElement view
3.2.2. Type system view
3.3. Behavior package
3.3.1. Control Structures
3.3.2. Variables
3.3.3. Call Expressions
3.3.4. Assignment
3.3.5. Literals
3.3.6. Lambda Expression
3.4. Unresolved view
3.5. Viewing Kermeta metamodel
4. Kermeta framework
A. Language keywords
B. Known Kermeta tags
C. Kermeta / Ecore mapping

List of Figures

1.1. Kermeta positioning
1.2. A concrete example : a library
2.1. A simple family tree model
2.2. : multiple inheritance
2.3. cs.ecore sample metamodel
2.4. : The Kermeta collections
2.5. Attributes and references
3.1. EMOF extension and Kermeta promotion
3.2. Structure package
3.3. NamedElement class diagram
3.4. Kermeta type system class diagram (the big picture)
3.5. Kermeta ModelType system class diagram
3.6. Kermeta ModelType adaptation class diagram
3.7. Behavior package
3.8. Behavior main metaclasses
3.9. Control structure
3.10. Use of variables
3.11. use of exceptions
3.12. Kermeta assignment expression
3.13. Kermeta Literal Expression
3.14. Kermeta lambda expressions
3.15. Unresolved view