oAW Presentation
-
Upload
saifkamaal -
Category
Documents
-
view
1.629 -
download
4
description
Transcript of oAW Presentation
Pragmatic MDA:
Domain Specific Languages
with Eclipse
Jos Warmer
Partner
1
Who, why
• Expert in Model Driven Development
• One of the authors of the UML standard
– Main architect of OCL
• Written some books• 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
Anatomy of Domain Specific
Languages
• The abstract syntax
– The domain model or meta model
• Validation rules
– What constitutes a correct model– 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
DSL Definition
Abstract Concrete Syntax
Validation
Rules
Code
generation
Checks /
OCL
Xtext / TMF
Concrete
Syntax
Concrete
Syntax
4
Abstract
Syntax
Concrete
Syntax
Syntax
Mapping
Syntax
Mapping
Syntax
Mapping
Ecore/EMF
Xpand / JET
/ Velocity
GMF
Abstract Syntax
5
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• 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
Eclipse: Ecore
Ecore
modelEditor
Java Code
generated
Editor
Runtime
EMF
model
generated
Model
Java Code
Edit
Java Code
generated
generated
generated
Model
Edit
Validation Rules
8
Validation rules
• The abstract syntax defines the structure
• Which instantiations of the abstract syntax are
valid?
• Specified by validation rules (or well-formedness• 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
Validation Rules in oAW /
Checks
Ecore
model
Editor
Runtime
10
Checks
rules
Model
Edit
Constraint
checker
Code Generation
11
Code Generation
• Makes a DSL “executable”
– Can generate anything
12
Code Generation with oAW
Xpand
Xpand
Templates
Editor
RuntimeXpand
Engine
Java Code
13
Ecore
model
Checks
rulesModel
Edit
Constraint
checker
HTML
XML
SQL
Etc.generated
Concrete Syntax
14
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• 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 mind15
Concrete syntax
• Textual versus graphical
– … or both !
• Standalone or embedded
– This presentation is about standalone only.– This presentation is about standalone only.
• Textual: oAW Xtext
– Alternative: TCS
– Both will move (end merge) into Eclipse Textual
Modeling Framework (TMF)
• Visual: Graphical Modeling Framework (GMF)
– No real alternatives
16
xText: DSL's made easy
Jeroen Benckhuijsen,
Meinte Boersma
Textual syntax: oAW Xtext
RuntimeXpand
Engine
Java CodeXtext
Xtext
Editor
generated
17
Ecore
model
Checks
rules
Xpand
Templates
Model
Edit
Editor
Constraint
checker
Java Code
HTML
XML
SQL
Etc.
generated
Xtext
Grammar Xtext
Editor
Textual Concrete Syntax
• Traditional parser technology
– Uses parser generator tools• ANTRL
• JavaCC
• Lex & Yacc
Building a Domain
Specific Language
with ANTLR v3 –
• Lex & Yacc
• …
– Grammar based (EBNF)
18
Jeroen Leenarts
Visual syntax: GMF
Xtext
RuntimeXpand
Engine
Java
What the
developer
sees
19
Ecore
model
Checks
rules
Xpand
Templates
Xtext
Grammar
GMF
Model
Model
Edit
Editor
Constraint
checker
Java
HTML
XML
SQL
Etc.
generated
Xtext
Editor
GMF
Editor