Pragmatic MDA:
Domain Specific Languages
      with Eclipse
        Jos Warmer
          Partner



                      ...
Who, why

• Expert in Model Driven Development
• One of the authors of the UML standard
   – Main architect of OCL
• Writt...
Anatomy of Domain Specific
           Languages
• The abstract syntax
   – The domain model or meta model
• Validation rul...
DSL Definition

  Code            Validation             Checks /
generation          Rules                 OCL
          ...
Abstract Syntax




      5
Abstract Syntax

• The abstract syntax describes the concepts of
  the DSL.
   – These concepts come directly from the dom...
Eclipse: Ecore
                                Runtime
 Ecore
 model
                     Editor
                         ...
Validation Rules




       8
Validation rules

• The abstract syntax defines the structure
• Which instantiations of the abstract syntax are
  valid?
•...
Validation Rules in oAW /
         Checks
                               Runtime
Ecore
model
                             ...
Code Generation




      11
Code Generation

• Makes a DSL “executable”
  – Can generate anything




                             12
Code Generation with oAW
            Xpand
  Xpand                    Xpand       Runtime
Templates                  Engin...
Concrete Syntax




      14
Concrete Syntax

• Concrete Syntax defines the “look” of the DSL
   – This is the only thing that users of the DSL
     ac...
Concrete syntax

• Textual versus graphical
   – … or both !
• Standalone or embedded
   – This presentation is about stan...
Textual syntax: oAW Xtext
 generated

  Xtext
  Editor             Xpand                       Runtime
                   ...
Textual Concrete Syntax

• Traditional parser technology
   – Uses parser generator tools
                                ...
Visual syntax: GMF                               What the
                                                             dev...
Thanks and have fun !


        Jos Warmer
   jos.warmer@ordina.nl
Upcoming SlideShare
Loading in …5
×

oAW Presentation

1,452 views

Published on

A beautiful presentation on oAW

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,452
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

oAW Presentation

  1. 1. Pragmatic MDA: Domain Specific Languages with Eclipse Jos Warmer Partner 1
  2. 2. Who, why • Expert in Model Driven Development • One of the authors of the UML standard – Main architect of OCL • Written some books – Praktisch UML – MDA Explained – Object Constraint Language • Partner at Ordina – Responsible for MDD – J-Technologies SMART-Java – Ordina Microsoft Solutions SMART-Microsoft
  3. 3. Anatomy of Domain Specific Languages • The abstract syntax – The domain model or meta model • Validation rules – What constitutes a correct model • The concrete syntax or notation – What does the language look like • Code generation – Making the DSL executable – Alternative: interpretation 3
  4. 4. DSL Definition Code Validation Checks / generation Rules OCL Xtext / TMF Abstract Syntax Concrete Syntax Mapping Syntax Syntax Concrete Mapping Syntax Xpand / JET / Velocity Syntax Concrete Mapping Syntax Ecore/EMF GMF 4
  5. 5. Abstract Syntax 5
  6. 6. Abstract Syntax • The abstract syntax describes the concepts of the DSL. – These concepts come directly from the domain • This is the vocabulary used in the domain – Often exists already with the domain experts • Usually modeled by a class diagram like notation – E.g. UML Class models • Also called – Meta model by the OMG – Domain model by Microsoft 6
  7. 7. Eclipse: Ecore Runtime Ecore model Editor Editor Java Code generated EMF Edit Edit model Java Code generated generated Model Model Java Code generated
  8. 8. Validation Rules 8
  9. 9. Validation rules • The abstract syntax defines the structure • Which instantiations of the abstract syntax are valid? • Specified by validation rules (or well-formedness rules) • E.g. – Class names must be unique – A class may not be a generalization of itself 9
  10. 10. Validation Rules in oAW / Checks Runtime Ecore model Editor Checks Edit rules Constraint Model checker 10
  11. 11. Code Generation 11
  12. 12. Code Generation • Makes a DSL “executable” – Can generate anything 12
  13. 13. Code Generation with oAW Xpand Xpand Xpand Runtime Templates Engine Editor Java Code HTML generated Ecore XML model SQL Edit Etc. Checks Constraint Model rules checker 13
  14. 14. Concrete Syntax 14
  15. 15. Concrete Syntax • Concrete Syntax defines the “look” of the DSL – This is the only thing that users of the DSL actually see • Concrete syntax is also called – Notation – Visualization – Surface syntax • A DSL may have more than one concrete syntax – Different types of users may require different concrete syntaxes – Concrete syntax should be designed with the user type in mind 15
  16. 16. Concrete syntax • Textual versus graphical – … or both ! • Standalone or embedded – This presentation is about standalone only. xText: DSL's made easy • Textual: oAW Xtext Jeroen Benckhuijsen, Meinte Boersma – Alternative: TCS – Both will move (end merge) into Eclipse Textual Modeling Framework (TMF) • Visual: Graphical Modeling Framework (GMF) – No real alternatives 16
  17. 17. Textual syntax: oAW Xtext generated Xtext Editor Xpand Runtime Engine Xtext Java Code Xtext Grammar Editor HTML Editor generated Xpand XML Templates SQL Edit Etc. Ecore model Constraint Model Checks checker rules 17
  18. 18. Textual Concrete Syntax • Traditional parser technology – Uses parser generator tools Building a Domain • ANTRL Specific Language • JavaCC with ANTLR v3 – • Lex & Yacc Jeroen Leenarts • … – Grammar based (EBNF) 18
  19. 19. Visual syntax: GMF What the developer sees Runtime Xpand Engine Xtext Java Xtext GMF Grammar Editor HTML Editor Editor generated Xpand XML Templates GMF SQL Model Etc. Edit Ecore model Constraint Model Checks checker rules 19
  20. 20. Thanks and have fun ! Jos Warmer jos.warmer@ordina.nl

×