The ¡State ¡of ¡the ¡Art ¡ in ¡External ¡DSLs ¡
WGT ¡2011 ¡
Markus ¡Voelter ¡ Independent/itemis ¡ voelter@acm.org ¡
in External DSLs WGT 2011 Markus Voelter - - PowerPoint PPT Presentation
The State of the Art in External DSLs WGT 2011 Markus Voelter Independent/itemis voelter@acm.org A li%le History DSLs Example: Fountains
The ¡State ¡of ¡the ¡Art ¡ in ¡External ¡DSLs ¡
WGT ¡2011 ¡
Markus ¡Voelter ¡ Independent/itemis ¡ voelter@acm.org ¡ ¡A ¡li%le ¡History ¡ ¡DSLs ¡ ¡Example: ¡Fountains ¡ ¡Programming ¡vs. ¡Modeling ¡ ¡ProjecAonal ¡EdiAng ¡ ¡Example: ¡Embedded ¡Development ¡
A ¡liGle ¡History ¡
programming ¡ close ¡to ¡the ¡hardware ¡
started ¡
abstracLons ¡ ¡ ¡ ¡compuLng ¡
∼ ¡
¡ ¡ ¡chips ¡
abstracLons ¡ ¡ ¡ ¡compuLng ¡
∼ ¡
¡ ¡ ¡bits ¡
¡ ¡ ¡C ¡
abstracLons ¡ ¡ ¡ ¡compuLng ¡
∼ ¡
¡ ¡ ¡Java ¡
abstracLons ¡ ¡ ¡ ¡compuLng? ¡
∼ ¡
¡ ¡ ¡SQL ¡
abstracLons ¡ ¡ ¡ ¡compuLng? ¡
∼ ¡
general ¡purpose ¡
domain ¡specific ¡
effecLve++ ¡ specialized, ¡limited ¡ used ¡by ¡experts ¡ together ¡with ¡other ¡ ¡ ¡ ¡ ¡specialized ¡tools ¡ tailor ¡made ¡
Domain ¡Specific ¡Languages ¡
A ¡DSL ¡is ¡a ¡focussed, ¡processable ¡ language ¡for ¡describing ¡a ¡specific ¡ concern ¡when ¡building ¡a ¡system ¡in ¡a ¡ specific ¡domain. ¡The ¡abstracLons ¡and ¡ notaLons ¡used ¡are ¡natural/suitable ¡for ¡ the ¡stakeholders ¡who ¡specify ¡that ¡ parAcular ¡concern. ¡
map ¡
DSL ¡Program ¡ GPL ¡Program ¡
(aka ¡Model) ¡
map ¡ automated! ¡
map ¡
GeneraLon ¡
TransformaLon ¡ CompilaLon ¡
InterpretaLon ¡
Analysing ¡Domains ¡ ¡ ¡ ¡Defining ¡Languages ¡
¡ ¡ ¡ ¡ ¡ ¡Building ¡Editors ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Transforming ¡Models ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Building ¡Generators ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Building ¡Frameworks ¡
AdapLng/SelecLng ¡
Analysing ¡Domains ¡ ¡ ¡ ¡Defining ¡Languages ¡
¡ ¡ ¡ ¡ ¡ ¡Building ¡Editors ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Transforming ¡Models ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Building ¡Generators ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡Building ¡Frameworks ¡
AdapLng/SelecLng ¡
… ¡and ¡using ¡all ¡of ¡that ¡to ¡build ¡apps ¡ ¡
Example ¡1: ¡ Fountain ¡Control ¡
¡CONTEXT ¡
¡SOLUTION ¡ Hardware ¡Structure ¡
¡SOLUTION ¡ Behaviour ¡
¡SOLUTION ¡ Plus: ¡ In-‑IDE ¡Simulator ¡ Unit ¡Test ¡Support ¡
TOOLS ¡ Eclipse ¡Modeling ¡ Eclipse ¡Xtext ¡
Programming ¡vs. ¡ Modeling ¡
Modeling ¡Tools ¡ ¡ Programming ¡Tools ¡ != ¡
Different ¡Worlds ¡
Modeling ¡Tool ¡ Modeling ¡Tool ¡ != ¡
Different ¡Worlds ¡
Different ¡Worlds ¡
Mix ¡Models ¡and ¡Programs ¡
Different ¡Worlds ¡
AST ¡NavigaLon ¡& ¡Query ¡ Mix ¡Models ¡and ¡Programs ¡
Different ¡Worlds ¡
AST ¡NavigaLon ¡& ¡Query ¡ Mix ¡Models ¡and ¡Programs ¡ Code ¡Constraints ¡
the ¡difference? ¡
History? ¡
Modeling ¡ Programming ¡
… ¡(Mostly) ¡Textual ¡ ¡ ¡ ¡ ¡ ¡NotaLons ¡
¡… ¡Concrete ¡Syntax ¡ ¡ ¡ ¡ ¡ ¡Storage ¡
¡… ¡(Fancy) ¡ASCII ¡Editors ¡
¡… ¡Read-‑Only ¡ ¡ ¡ ¡ ¡ ¡VisualizaLons ¡ ¡
Modeling ¡
… ¡(Mostly) ¡Graphical ¡ ¡ ¡ ¡ ¡NotaLons ¡
¡… ¡Abstract ¡Syntax ¡ ¡ ¡ ¡ ¡ ¡Storage ¡
¡… ¡ProjecLng ¡Editors ¡
¡… ¡Different ¡editable ¡ ¡ ¡ ¡ ¡views ¡for ¡model ¡ ¡
Programming ¡
… ¡(Mostly) ¡Textual ¡ ¡ ¡ ¡ ¡ ¡NotaLons ¡
¡… ¡Concrete ¡Syntax ¡ ¡ ¡ ¡ ¡ ¡Storage ¡
¡… ¡(Fancy) ¡ASCII ¡Editors ¡
¡… ¡Read-‑Only ¡ ¡ ¡ ¡ ¡ ¡VisualizaLons ¡ ¡
the ¡difference? ¡
It ¡is ¡Lme ¡for ¡… ¡
… ¡a ¡Different ¡PerspecLve ¡
Programming ¡
the ¡way ¡we ¡do ¡
Modeling? ¡ Modeling ¡
the ¡way ¡we ¡do ¡
Programming? ¡
Modeling ¡ Programming ¡ Programming ¡ Modeling ¡
== ¡ == ¡
We ¡don‘t ¡want ¡to ¡
we ¡want ¡to ¡
model, ¡
program! ¡
We ¡don‘t ¡want ¡to ¡
we ¡want ¡to ¡
model, ¡
program! ¡
… ¡at ¡different ¡levels ¡of ¡abstacLon ¡ … ¡from ¡different ¡viewpoints ¡ … ¡integrated! ¡
We ¡don‘t ¡want ¡to ¡
we ¡want ¡to ¡
model, ¡
program! ¡
… ¡with ¡different ¡degrees ¡of ¡ ¡ … ¡with ¡suitable ¡notaLons ¡ … ¡with ¡suitable ¡expressiveness ¡ domain-‑specificity ¡
We ¡don‘t ¡want ¡to ¡
we ¡want ¡to ¡
model, ¡
program! ¡
precise ¡and ¡tool ¡processable ¡ And ¡always: ¡
Programming ¡ ¡ Languages ¡
are ¡not ¡
MODULAR ¡
Programming ¡ ¡ Languages ¡
are ¡not ¡
COMPOSABLE ¡
Programming ¡ ¡ Languages ¡
are ¡not ¡
CONFIGURABLE ¡
Programming ¡ ¡ Languages ¡
are ¡not ¡
ADAPTABLE ¡
Programming ¡ ¡ Language ¡Syntax ¡
is ¡not ¡
FLEXIBLE ¡
L ¡
a ¡ b ¡ c ¡ d ¡ e ¡ f ¡ g ¡ h ¡ i ¡ j ¡ k ¡ m ¡ n ¡with ¡many ¡first ¡class ¡concepts! ¡
Big ¡Language? ¡
L ¡
α ¡ β ¡ λ ¡ ω ¡ δ ¡ Small ¡Language? ¡
and ¡poweful ¡concepts ¡ with ¡a ¡few, ¡orthogonal ¡
α ¡ β ¡
a ¡ b ¡ c ¡ d ¡ e ¡ f ¡ g ¡ h ¡ i ¡ j ¡ k ¡ l ¡Modular ¡Language ¡
composable ¡ ¡concepts ¡ with ¡many ¡opLonal, ¡
Like ¡frameworks ¡ ¡ and ¡libraries, ¡ ¡ but ¡with ¡syntax ¡ and ¡IDE ¡support ¡
Modular ¡Language ¡
ProjecLonal ¡ EdiLng ¡
Parser-‑based ¡
text ¡ … ¡to ¡tree ¡ … ¡to ¡text ¡
ProjecLonal ¡
tree ¡ … ¡to ¡text-‑lookalike ¡(editor) ¡ … ¡to ¡other ¡trees ¡… ¡[*] ¡ … ¡to ¡text ¡ ¡
Programming ¡as ¡Modeling ¡
… ¡(Mostly) ¡Graphical ¡ ¡ ¡ ¡ ¡NotaLons ¡
¡… ¡Abstract ¡Syntax ¡ ¡ ¡ ¡ ¡ ¡Storage ¡
¡… ¡ProjecLng ¡Editors ¡
¡… ¡Different ¡editable ¡ ¡ ¡ ¡ ¡views ¡for ¡model ¡ ¡
Programming ¡as ¡Modeling ¡
… ¡(Mostly) ¡Graphical ¡Any ¡kind ¡of ¡ ¡ ¡ ¡ ¡NotaLons ¡
¡… ¡Abstract ¡Syntax ¡ ¡ ¡ ¡ ¡ ¡Storage ¡
¡… ¡ProjecLng ¡Editors ¡
¡… ¡Different ¡editable ¡ ¡ ¡ ¡ ¡views ¡for ¡model ¡ ¡
Language ¡
There‘s ¡no ¡parsing. ¡ Unique ¡Language ¡Element ¡IdenLty. ¡ Unlimted ¡language ¡composiLon. ¡
ComposiLon ¡
Textual ¡ Graphical ¡ Semi-‑Graphical ¡
treated ¡the ¡same ¡ can ¡be ¡mixed ¡
like ¡ASCII ¡ } ¡ box ¡& ¡line ¡ mathemaLcal ¡
Flexible ¡
NotaLons ¡
AutomaLc ¡
IDE ¡Extension ¡
tool ¡support ¡is ¡inherent ¡ for ¡languages ¡build ¡with ¡ projecLonal ¡tools ¡
language ¡definiLon ¡ IDE ¡definiLon ¡
implies ¡MulLple ¡
NotaLons ¡
… ¡for ¡the ¡same ¡concepts ¡ e.g. ¡in ¡different ¡contexts ¡
ParLal ¡
ProjecLons ¡
… ¡different ¡views ¡ … ¡for ¡different ¡roles/people ¡ … ¡only ¡a ¡parLcular ¡variant ¡
Programs ¡
Live ¡
think: ¡spreadsheet ¡ a ¡change ¡to ¡one ¡part ¡of ¡program ¡ can ¡lead ¡to ¡(dependent) ¡changes ¡ in ¡other ¡parts ¡
Tree ¡EdiLng ¡
… ¡try ¡to ¡make ¡it ¡feel ¡like ¡text ¡ … ¡takes ¡some ¡gelng ¡used ¡to ¡
but: ¡for ¡more ¡flexible ¡notaLons ¡ ¡ a ¡more ¡general ¡ediLng ¡paradigm ¡ ¡ is ¡needed ¡
… ¡is ¡different ¡from ¡ediLng ¡text ¡
Infrastructure ¡
IntegraLon ¡
… ¡diff/merge ¡must ¡be ¡in ¡tool ¡ … ¡exisLng ¡text ¡tools ¡don‘t ¡work ¡ … ¡storage ¡is ¡not ¡text ¡
Proprietary ¡
Tools ¡
… ¡no ¡interop ¡ … ¡no ¡standards ¡
Example ¡2: ¡ Embedded ¡Systems ¡
Example ¡2: ¡
Embedded ¡Systems ¡ ¡
¡EXAMPLE ¡CASE ¡
¡SOLUTION ¡
¡SOLUTION ¡
¡SOLUTION ¡
TOOLS ¡ JetBrains ¡MPS ¡
THE ¡END. ¡