1 / 34

Elevator Simulator DSL Project

Elevator Simulator DSL Project. Presented by Miguel Garzón and Stéphane Leblanc. Elevator Simulator. Framework to test the behaviors of elevators in different scenarios Open Source (LGPL) Java Project Authors: Neil McKellar and Chris Dailey

judson
Download Presentation

Elevator Simulator DSL Project

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  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 athttp://elevatorsim.sourceforge.net/

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

  4. Introductory Example • View the example

  5. Goals of the DSL • Easy to read • Concise • Easy to write • Maintainable • Easy to parse

  6. 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. DSL Metamodel (1)

  8. DSL Metamodel (2) • User Variables

  9. DSL Overview – Metamodel (3)

  10. DSL Creation Technology (1) JET

  11. 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. 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 ecoremodel or a grammardefinition.

  13. Xtext- Generated Artefacts xText OPTIONAL BNF GRAMMAR SEMANTIC MODEL (ECORE) Generates Generates EDITOR PARSER

  14. Xtext- Generated Artefacts xText PARSER EDITOR SEMANTIC MODEL (ECORE) BNF GRAMMAR EMF Model Code

  15. EMF Code Generation • The generated code will consists out of the following: • Interfacesand 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. Xtext- DSL Processing xText EDITOR PARSER BNF GRAMMAR SEMANTIC MODEL (ECORE) Generated Interpreted ESIM file Generated Java Class

  17. 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. JET (Java Emitter Templates) <%@ jet package="org.intranet.sim.dsl.codegen" class="ScenarioGenerator" imports="org.intranet.sim.dsl.scenarioGenerator.*" skeleton="generator.skeleton" %> <% Model model = (Model) argument; Scenario scenario = model.getScenario(); String displayName = scenario.getDisplayName(); String className = scenario.getName(); ... %> public class <%=className%> extends Simulator { … }

  19. Xtext Features (1) • Code Completion • Syntax Highlighting • Linking • Scoping • IntelliSense  • Quick Fix • Warnings

  20. Xtext Features (2) • Test cases: (for testing the editor)

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

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

  23. Editor Sample Usage

  24. Intelisense: Select a Variable

  25. Syntactic Error: Grammatically Incorrect

  26. Semantic Error: Makes No Sense Semantic Error: Makes No Sense

  27. Deprecated

  28. Quick Fix

  29. Strategies for LanguageEvolution (1) • Incremental Migrations[FowlerMig] V1.1 V1.0 V2.0

  30. Strategies for LanguageEvolution (2) • Model-based migrations [FowlerMig] V1.0 V2.0 V1.1

  31. Strategies for LanguageEvolution (3) • Maintain backward compatibility (Selected) V2.0 V1.1 V1.0

  32. Conclusion • Elevator Simulator DSL simplifies the creation of scenarios • Powered by XText • Allows for model interpretationand for code generation

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

More Related