Presentation is loading. Please wait.

Presentation is loading. Please wait.

Elevator Simulator DSL Project Presented by Miguel Garzón and Stéphane Leblanc 1.

Similar presentations


Presentation on theme: "Elevator Simulator DSL Project Presented by Miguel Garzón and Stéphane Leblanc 1."— Presentation transcript:

1 Elevator Simulator DSL Project Presented by Miguel Garzón and Stéphane Leblanc 1

2 Elevator Simulator Framework to test the behaviors of elevators in different scenarios Open Source (LGPL) Java Project Authors: Neil McKellar and Chris Dailey More details can be found at http://elevatorsim.sourceforge.net/ http://elevatorsim.sourceforge.net/ 2

3 Elevator Simulator DSL Domain Specific Language (DSL) over the Elevator Simulator API Allow to create elevator simulation scenarios 3

4 Introductory Example View the example 4

5 5

6 Goals of the DSL 1.Easy to read 2.Concise 3.Easy to write 4.Maintainable 5.Easy to parse 6

7 Target Audience Developers – Who want to create scenarios for the Elevator Simulator – Who want to look at a DSL implementation example Non-programmers not taken into account 7

8 DSL Metamodel (1) 8

9 User Variables DSL Metamodel (2) 9

10 DSL Overview – Metamodel (3) 10

11 DSL Creation Technology (1) 11

12 DSL Creation Technology (2) Eclipse IDE The Elevator Simulator DSL is deeply integrated with Eclipse. Our DSL comes in the form of an Eclipse Plug-in. 12

13 DSL Creation Technology (3) Xtext for definition of BNF Grammar and Metamodel generation. Xtext is an Eclipse-based DSL generator that was released in 2006 and is built on top of Antlr and other famous Eclipse projects. One can create Xtext Projects from ecore model or a grammar definition. 13

14 xTextxText Xtext- Generated Artefacts OPTIONAL Generates Generates 14

15 xTextxText Xtext- Generated Artefacts EMF Model Code 15

16 EMF Code Generation The generated code will consists out of the following: – Interfaces and the Factory to create the Java classes – Concrete implementation of the interfaces defined in model – Utilities Possibility to modify and extend generated code. – Code that is explicitly marked as @generated NOT is not overwritten. 16

17 xTextxText Xtext- DSL Processing Generated Java Class ESIM file Interpreted Generated 17

18 DSL Creation Technology (4) JET (Java Emitter Templates): For Code Generation. JET will be used to translate our domain specific language into Java classes representing the scenarios that will work with the Elevator Simulator. 18

19 JET (Java Emitter Templates) <% Model model = (Model) argument; Scenario scenario = model.getScenario(); String displayName = scenario.getDisplayName(); String className = scenario.getName();... %> public class extends Simulator { … } 19

20 Xtext Features (1) Code Completion Syntax Highlighting Linking Scoping IntelliSense Quick Fix Warnings 20

21 Xtext Features (2) Test cases: (for testing the editor) 21

22 Xtext Features –Validation (1) Semantic Validation: From OCL constraints defined in the Ecore Model, validation code is generated. 22

23 Extension Points Eclipse provides the concept of "extension points“. Elevator Sim provides menu actions, icons to enhance the user experience. – org.eclipse.ui.actionSets 23

24 Editor Sample Usage 24

25 Intelisense: Select a Variable 25

26 Syntactic Error: Grammatically Incorrect 26

27 Semantic Error: Makes No Sense 27

28 Deprecated 28

29 Quick Fix 29

30 Strategies for Language Evolution (1) Incremental Migrations[FowlerMig] V2.0 V1.1 V1.0 30

31 Strategies for Language Evolution (2) Model-based migrations [FowlerMig] V2.0 V1.1 V1.0 31

32 Strategies for Language Evolution (3) Maintain backward compatibility (Selected) V2.0 V1.1 V1.0 32

33 Conclusion Elevator Simulator DSL simplifies the creation of scenarios Powered by XText Allows for model interpretation and for code generation 33

34 References [FowlerDsl] Martin, Fowler, Domain-specific language, ISBN 0321712943 [FowlerMig] Fowler, Martin, DSL Migration, 2009/02/05 http://martinfowler.com/bliki/DslMigration.html http://martinfowler.com/bliki/DslMigration.html Bell, Peter, DSL Evolution, 2009/12/22 http://www.infoq.com/articles/dsl-evolution http://www.infoq.com/articles/dsl-evolution Tolvanen, JP, DSL in Practice, 2008/12/07, Software Engineering Radio, episode 119 http://www.se-radio.net/?s=DSL http://www.se-radio.net/?s=DSL 34


Download ppt "Elevator Simulator DSL Project Presented by Miguel Garzón and Stéphane Leblanc 1."

Similar presentations


Ads by Google