Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building Modular and Efficient DSML in Eclipse

Similar presentations


Presentation on theme: "Building Modular and Efficient DSML in Eclipse"— Presentation transcript:

1 Building Modular and Efficient DSML in Eclipse
Breathe life into your metamodels Building Modular and Efficient DSML in Eclipse The KERMETA Experience (v2!) O. Barais, B. Baudry, J. Bourcier, A. Blouin, B. Combemale, J.-M. Jézéquel, N. Plouzeau, D. Vojtisek EclipseCon Europe, Ludwigsburg, Oct 2013

2 Triskell research group

3 Triskell Permanent staff 20 PhD students 4 engineers, 2 postdoc
Olivier Barais (MCF UR1) Benoit Baudry (CR INRIA) Arnaud Blouin (MCF INSA) Johann Bourcier (MCF UR1) Benoit Combemale (MCF UR1) Jean-Marc Jézéquel (PR UR1) Noël Plouzeau (MCF UR1) Gerson Sunyé (on sabatycal) Didier Vojtisek (IR INRIA) 20 PhD students 4 engineers, 2 postdoc

4 The Kermeta Workbench: Goals
Offer a generic solution covering most model manipulation needs Focus of this talk: Design of DSML modular and safe Implementation of DSML scalable, interoperable and runtime a workbench dedicated to metamodeling activities Help building a set of tools for a given domain (metamodel) Those tools must interoperate with third party tools Ex: modelers, other transformations,… Generalize generative and transformation techniques Use mechanisms that allow to scale up if necessary Simplify use of design patterns that have proved to be useful for metamodeling activities Help to detect errors as soon as possible Building modular and efficient DSL tools with Kermeta November 18, 2018

5 What our users want to build
Designing a DSML Editors (textuals, graphicals, …) Checkers (static & dynamics) Documentation generators Compilers What our users want to build Test generators Translators Simulators Code generators Analyzers Etc. Refactoring Building modular and efficient DSL tools with Kermeta November 18, 2018

6 xText, EMFText, GMF, Topcased, Antlr…
Designing a DSML MOF/Ecore + OCL Abstract Syntax (+ static semantics) * * Concrete syntax Focus on the integration of various concerns and tooling Kermeta workbench makes it possible to mashup these meta-languages Dynamic Semantics xText, EMFText, GMF, Topcased, Antlr… QVT*, Kermeta AL, Java EMF… Building modular and efficient DSL tools with Kermeta November 18, 2018

7 What our users want to build
Designing a DSML Building DSML tools involves several DSMLs at the meta level Mashup of metalanguages! We apply AOM at the metamodeling level Aspect Oriented MetaModeling (AOMM) Editors (textuals, graphicals, …) Checkers (static & dynamics) Documentation generators What our users want to build Compilers Test generators Translators Simulators Code generators Same as building an eclipse tool with the specificity of reusing modeling technology for speeding up the developments. Organized around a (set of) metamodel(s) representing the domain Analyzers Etc. Refactoring Building modular and efficient DSL tools with Kermeta November 18, 2018

8 Designing a DSML Separation of Concerns
A DSML involves several concerns (syntax, semantics…), for many purposes (edition, simulation, generation, interoperability…) Use appropriate language for each use Compose them as necessary Solution in the Kermeta Workbench: Static Introduction Ecore: abstract syntax (metamodel) is the core language OCL: constraints (inv., pre-, post-) Kermeta Action Language: side effects = model manipulation Additional extension mechanisms : add classes, operations, attributes, property opposite, inheritance … Composition mechanism : Model element composition: keyword aspect Model composition: keyword import AL Abstract syntax = Ecore or MOF Static semantic = OCL Dynamic semantic = Kermeta action language, QVT, java, scala Kermeta action language : Basically an OO extention to MOF/ecore + other Model oriented features Concrete syntax = GMF/Topcased, xText, EMFtext, antlr, Merge/aspect directive for combining them Implementation of the merge to produce the runtime Compiler Not to be confused with AspectJ aspects ! Building modular and efficient DSL tools with Kermeta November 18, 2018

9 Principle of the mashup
context FSM inv: ownedState->forAll(s1,s2| s1.name=s2.name implies s1=s2) aspect class FSM{ reference currentState : State operation run() : Void is do end } aspect class Transition { operation fire() : EString is do source.owningFSM.currentState := target result := output AL import "FSM.ecore" import "FSM.ocl" import "FSMbehavior.kmt inv: ownedState->forAll(s1,s2| s1.name=s2.name implies s1=s2) Technically speaking, the principle used here is not new anymore (some other tools also do it) but we generalize it Model of the resulting composition Building modular and efficient DSL tools with Kermeta November 18, 2018

10 Action language feature highlight
AL Statically Typed Generics, Function types (for OCL-like iterators) Object-Oriented Multiple inheritance / dynamic binding / reflection Model-Oriented Model are first class citizens, notion of model type Design by contract Aspect-Oriented Simple syntax for static introduction Still “kernel” language Use JVM/Scala bytecode compatibility for GUI/IO etc. Building modular and efficient DSL tools with Kermeta November 18, 2018

11 Separation of concerns using OO Visitor versus AO Visitor
<<Abstract>> Visitor visit(e : VisitableElement) <<Abstract>>Visitable Element accept(v : Visitor) "Visiting " + e.name + "!!" v.visit(self) MyCompiler main() root 1 MyCompiler main() root 1 Concrete Visitor visit(e : VisitableElement) "Compiling " + e.name "Compiling " + e.name Concrete Element compile() Ecore-to- EcoreVisitable Concrete Element Illustrates how the aspect weavig mechanism allows simple an elegant design for an equivalent result. Last but not least, simplified like this, the code is more efficient because its call stack can be shallower. metamodel.ecore metamodel.ecore <<require>> metamode_ visitable .ecore Simu1 .kmt <<require>> compiler1.java compiler1.kmt <<require>> compiler2.kmt compiler2.java Simu1 .java Building modular and efficient DSL tools with Kermeta November 18, 2018

12 Implementing a DSML: Mashup of the concerns into bytecode
Probably, the most important slide for the talk at EclipseCon France: It explain teh integration of the generated code in the Eclipse platform taking into account legacy code. Legacy is : - Other EMF tools - EMF bytecode provided by the user (might be customised) Standard EMF tooling <<use>> Building modular and efficient DSL tools with Kermeta November 18, 2018

13 Internal workflow + modular Architecture
Kmt parser Checker Km loader Ecore 2 km Merger Resolver KM 2 scala Scala 2 bytecode UML profile 2 km QVT 2 km KP Project Orchestration OCL 2 km Clean FrontEnd-BackEnd structure Front end: allows integration of various metalanguages (or language use at the meta level) Back end: various back end are possible depending on performance and compatibility required fUML 2 km Integration Ket 2 km Allow integration of new "meta" languages Customisable with other steps (optimization, slicing,…) ALF 2 km Building modular and efficient DSL tools with Kermeta November 18, 2018

14 Implementing a DSML: Consequence
Runtime is more efficient Ex Hashtable : no search, ask directly the object Ex visitor: No more "ping pong" overhead between accept and visit methods Validation: Java-based vs. Kermeta-based implementation of fUML fUML samples published by the Java-based reference implementation Building modular and efficient DSL tools with Kermeta November 18, 2018 - 14

15 Conclusion: Kermeta Workbench
Modular design of DSMLs One meta-language per language concern (import) Ecore, OCL, Kermeta Action Language But also: QVTo, fUML, Alf, Ket, Xsd… Specific architecture supporting this Static introduction mechanism Efficient implementation of DSMLs Mashup of the meta-languages to efficient bytecode Integrated with third-party tools (EMF compliant) Building modular and efficient DSL tools with Kermeta November 18, 2018

16 Conclusion: Kermeta Action Language
Provides a model oriented action language to implement (E)Operation’s bodies allows common model manipulation tasks Imperative, statically typed, object-oriented, aspect-oriented (aspect, context), model-oriented, DbC, Unit testing Java and Scala compliant EMF based Run as Eclipse plugin or as standard Java application Building modular and efficient DSL tools with Kermeta November 18, 2018

17 Ongoing work: Extend and compile Model Type
reusable transformation A metamodel is used to: Build a model Type a model (aka model type) A metamodel is substitutable to another through a matching relation (extended from the one introduced in OO between “type groups” [Bruce et al.]) Provide the typing facilities in software language engineering from abstraction, reuse and safety to impact analyses and auto-completion) 4 matching relations according to two orthogonal criteria: total vs partial (subgraph) iso vs non-iso Model TypeC reusable transformation <<matches>> Model TypeA Meta ModelA Model TypeB <<matches>> <<conformsTo>> <<typedBy>> <<typedBy>> ModelA ModelB Building modular and efficient DSL tools with Kermeta November 18, 2018

18 Breathe life into your metamodels
Conclusion Kermeta Smoothly interoperates with Eclipse/EMF Open Source, available on the Inria Forge V2.1.0 Breathe life into your metamodels Home page Development page 18 novembre 2018-

19 Questions ?


Download ppt "Building Modular and Efficient DSML in Eclipse"

Similar presentations


Ads by Google