Domain-Specific Engineering of Domain-Specific Languages Rapha el - - PowerPoint PPT Presentation

domain specific engineering of domain specific languages
SMART_READER_LITE
LIVE PREVIEW

Domain-Specific Engineering of Domain-Specific Languages Rapha el - - PowerPoint PPT Presentation

context and problem our example DSL foundations constructing DSLs from model to artifact our example... conclusion Domain-Specific Engineering of Domain-Specific Languages Rapha el Mannadiar and , Hans Vangheluwe McGill


slide-1
SLIDE 1

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

Domain-Specific Engineering of Domain-Specific Languages

†Rapha¨

el Mannadiar and †,‡Hans Vangheluwe

†McGill University, Canada and ‡University of Antwerp, Belgium

October 18th @ DSM 2010

domain-specific engineering of domain-specific languages 1/50

slide-2
SLIDE 2

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

  • utline

1 context and problem 2 our example 3 DSL foundations 4 constructing DSLs 5 from model to artifact 6 our example... 7 conclusion

domain-specific engineering of domain-specific languages 2/50

slide-3
SLIDE 3

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

  • utline

1 context and problem 2 our example 3 DSL foundations 4 constructing DSLs 5 from model to artifact 6 our example... 7 conclusion

domain-specific engineering of domain-specific languages 3/50

slide-4
SLIDE 4

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

why do domain-specific modelling (DSM)? problem and solution domains are often far apart

mapping problems to solutions manually is difficult, slow and

error-prone

DSM enables the modelling of problems instead of solutions and automates the mapping between them

domain-specific engineering of domain-specific languages 4/50

slide-5
SLIDE 5

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

how does it work?

past UML-to-code efforts only succeeded in generating partial

applications

how can complete artifacts be generated from

domain-specific models (DSms)?

domain-specific engineering of domain-specific languages 5/50

slide-6
SLIDE 6

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

how does it work?

past UML-to-code efforts only succeeded in generating partial

applications

how can complete artifacts be generated from

domain-specific models (DSms)? restricting modelling language expressiveness to a narrow

domain is the key to giving models unambiguous semantics

domain-specific engineering of domain-specific languages 6/50

slide-7
SLIDE 7

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

DSM for DSM?

DSL designers (i.e., DSM experts) design models of languages (e.g., using UML) and their mappings to the solution domain (e.g., code generators) using UML?! but you just said... and doesn’t DSM automate that mapping and deliver complete artifacts to modellers?

domain-specific engineering of domain-specific languages 7/50

slide-8
SLIDE 8

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

DSM for DSM?

DSL designers (i.e., DSM experts) design models of languages (e.g., using UML) and their mappings to the solution domain (e.g., code generators) using UML?! but you just said... and doesn’t DSM automate that mapping and deliver complete artifacts to modellers? so couldn’t it be used to deliver complete artifacts to DSL

designers as well?

domain-specific engineering of domain-specific languages 8/50

slide-9
SLIDE 9

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

  • ur solution, in a nutshell

we propose an approach to domain-specific language (DSL)

design that builds on DSM principles by providing dsl designers

with constructs specific to their domain (i.e., the domain of all DSLs) which enables the automatic generation of

DSm-to-artifact semantic mappings

domain-specific engineering of domain-specific languages 9/50

slide-10
SLIDE 10

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

  • utline

1 context and problem 2 our example 3 DSL foundations 4 constructing DSLs 5 from model to artifact 6 our example... 7 conclusion

domain-specific engineering of domain-specific languages 10/50

slide-11
SLIDE 11

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

phoneapps, a DSL for mobile applications

domain-specific engineering of domain-specific languages 11/50

slide-12
SLIDE 12

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

from DSm to mobile application

domain-specific engineering of domain-specific languages 12/50

slide-13
SLIDE 13

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

from DSm to mobile application

domain-specific engineering of domain-specific languages 13/50

slide-14
SLIDE 14

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

from DSm to mobile application

domain-specific engineering of domain-specific languages 14/50

slide-15
SLIDE 15

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

from DSm to mobile application

domain-specific engineering of domain-specific languages 15/50

slide-16
SLIDE 16

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

from DSm to mobile application

domain-specific engineering of domain-specific languages 16/50

slide-17
SLIDE 17

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

  • utline

1 context and problem 2 our example 3 DSL foundations 4 constructing DSLs 5 from model to artifact 6 our example... 7 conclusion

domain-specific engineering of domain-specific languages 17/50

slide-18
SLIDE 18

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

DSLs 101

a DSL has three components

abstract syntax

language concepts and relationships + constraints that encode domain rules

concrete syntax(es)

graphical and/or textual representations of abstract syntax elements

semantics

compilers and/or interpreters that define the meaning of instance models in the language

domain-specific engineering of domain-specific languages 18/50

slide-19
SLIDE 19

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

DSLs 101

a DSL has three components

abstract syntax

language concepts and relationships + constraints that encode domain rules

concrete syntax(es)

graphical and/or textual representations of abstract syntax elements

semantics

compilers and/or interpreters that define the meaning of instance models in the language DSL abstract syntax is commonly specified and communicated via UML class diagrams DSL semantics are commonly specified as code generators or model transformations

domain-specific engineering of domain-specific languages 19/50

slide-20
SLIDE 20

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

claims and questions

  • ur approach is based on two claims

any conceivable DSL is a combination of a finite set

  • f lower level formalisms

domain-specific engineering of domain-specific languages 20/50

slide-21
SLIDE 21

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

claims and questions

  • ur approach is based on two claims

any conceivable DSL is a combination of a finite set

  • f lower level formalisms

which formalisms form this basis for DSL design? how can DSLs be defined in terms of these base formalisms?

domain-specific engineering of domain-specific languages 21/50

slide-22
SLIDE 22

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

claims and questions... knowing how base formalisms are combined to form a given DSL is sufficient to construct its full semantics

domain-specific engineering of domain-specific languages 22/50

slide-23
SLIDE 23

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

claims and questions... knowing how base formalisms are combined to form a given DSL is sufficient to construct its full semantics how can artifacts be generated from instance models of these

DSLs without manually defined DSL semantics?

how can semantic transformations be generated from

a DSL definition?

domain-specific engineering of domain-specific languages 23/50

slide-24
SLIDE 24

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

base formalisms

statecharts

domain-specific engineering of domain-specific languages 24/50

slide-25
SLIDE 25

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

base formalisms

statecharts petri nets

domain-specific engineering of domain-specific languages 25/50

slide-26
SLIDE 26

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

base formalisms

statecharts petri nets causal block diagrams

domain-specific engineering of domain-specific languages 26/50

slide-27
SLIDE 27

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

base formalisms...

layout

domain-specific engineering of domain-specific languages 27/50

slide-28
SLIDE 28

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

base formalisms...

layout action code

domain-specific engineering of domain-specific languages 28/50

slide-29
SLIDE 29

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

base formalisms...

  • ur basis is a work in progress

so far, we can use it to model DSLs that arbitrarily combine determinism and non-determinism states and transitions discrete and continuous flow user interfaces api calls and code-based escape semantics

domain-specific engineering of domain-specific languages 29/50

slide-30
SLIDE 30

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

  • utline

1 context and problem 2 our example 3 DSL foundations 4 constructing DSLs 5 from model to artifact 6 our example... 7 conclusion

domain-specific engineering of domain-specific languages 30/50

slide-31
SLIDE 31

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

semantic templates

we need domain-specific concepts to be related to base

formalisms tightly enough to enable automatic generation of DSL-to-base-formalism transformations

domain-specific engineering of domain-specific languages 31/50

slide-32
SLIDE 32

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

semantic templates

we need domain-specific concepts to be related to base

formalisms tightly enough to enable automatic generation of DSL-to-base-formalism transformations

we introduce semantic templates (STs) as “interfaces” to base formalisms each base formalism “exposes” a set of STs that encode

the unambiguous mapping of arbitrary domain-specific

concepts onto concepts from the given base formalism.

domain-specific engineering of domain-specific languages 32/50

slide-33
SLIDE 33

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

a statechart ST

Steps transition to Steps

Steps become children of Statechart.State Steps can be connected via Statechart.Transition edges a set of such connected Steps can be projected onto a statechart

domain-specific engineering of domain-specific languages 33/50

slide-34
SLIDE 34

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

a generic ST

Actions and Screens are types of Steps

Actions and Screens become children of Steps they can now also be connected via Statechart.Transition edges

domain-specific engineering of domain-specific languages 34/50

slide-35
SLIDE 35

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

a generic ST

Actions and Screens are types of Steps

Actions and Screens become children of Steps they can now also be connected via Statechart.Transition edges

domain-specific engineering of domain-specific languages 35/50

slide-36
SLIDE 36

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

semantic templates...

so what exactly can we infer from a set of STs?

1 how to construct an internal UML class diagram of a DSL

(abstract syntax)

domain-specific engineering of domain-specific languages 36/50

slide-37
SLIDE 37

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

semantic templates...

so what exactly can we infer from a set of STs?

1 how to construct an internal UML class diagram of a DSL

(abstract syntax)

2 how to map a DSm onto base formalism instance models

(semantics)

domain-specific engineering of domain-specific languages 37/50

slide-38
SLIDE 38

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

  • utline

1 context and problem 2 our example 3 DSL foundations 4 constructing DSLs 5 from model to artifact 6 our example... 7 conclusion

domain-specific engineering of domain-specific languages 38/50

slide-39
SLIDE 39

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

divided and conquered

artifact synthesis now consists in automatically generating

1 base formalism instances fi from the DSm 2 desired artifacts ai (e.g., Java code) for each fi

domain-specific engineering of domain-specific languages 39/50

slide-40
SLIDE 40

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

divided and conquered

artifact synthesis now consists in automatically generating

1 base formalism instances fi from the DSm 2 desired artifacts ai (e.g., Java code) for each fi

it no longer falls upon the DSL designer to manually define the mapping of hand-picked portions of DSms onto lower level formalisms

domain-specific engineering of domain-specific languages 40/50

slide-41
SLIDE 41

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

divided, conquered, and reunited artifacts ai might need to interact

domain-specific engineering of domain-specific languages 41/50

slide-42
SLIDE 42

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

divided, conquered, and reunited artifacts ai might need to interact how?

we push the idea of “interfaces to base formalisms” base formalisms are now described by STs and i/o events a new generic ST enables inter-artifact event mapping

  • n event e1, produce event e2

domain-specific engineering of domain-specific languages 42/50

slide-43
SLIDE 43

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

divided, conquered, and reunited...

remember that Screens and Actions are Statechart.States entering a Screen should display it, entering an Action should launch it we want to map statechart events to Action Code and Layout events...

domain-specific engineering of domain-specific languages 43/50

slide-44
SLIDE 44

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

divided, conquered, and reunited...

remember that Screens and Actions are Statechart.States entering a Screen should display it, entering an Action should launch it we want to map statechart events to Action Code and Layout events...

  • n event enteredState:s, produce event drawCanvas:s
  • n event enteredState:s, produce event runCode:s

domain-specific engineering of domain-specific languages 44/50

slide-45
SLIDE 45

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

  • utline

1 context and problem 2 our example 3 DSL foundations 4 constructing DSLs 5 from model to artifact 6 our example... 7 conclusion

domain-specific engineering of domain-specific languages 45/50

slide-46
SLIDE 46

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

beneath the phoneapps DSL

domain-specific engineering of domain-specific languages 46/50

slide-47
SLIDE 47

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

beneath a phoneapps DSm

generated artifact(s) for each base formalism interaction via events

domain-specific engineering of domain-specific languages 47/50

slide-48
SLIDE 48

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

  • utline

1 context and problem 2 our example 3 DSL foundations 4 constructing DSLs 5 from model to artifact 6 our example... 7 conclusion

domain-specific engineering of domain-specific languages 48/50

slide-49
SLIDE 49

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

  • ur solution, in a nutshell

we proposed a novel approach to defining DSLs based on the

combination of base formalisms that capture commonly

recurring DSL features domain-specific concepts are unambiguously mapped onto base formalisms via semantic templates given “base formalism to target artifact” transformations, DSms can be transformed to the said target artifacts without the DSL

designer having to manually define the semantic mapping

  • ur approach brings DSM to DSM

domain-specific engineering of domain-specific languages 49/50

slide-50
SLIDE 50

context and problem

  • ur example

DSL foundations constructing DSLs from model to artifact

  • ur example...

conclusion

questions?

thank you!

domain-specific engineering of domain-specific languages 50/50