Domain Specific Language with pleasure
-
Upload
vaclav-pech -
Category
Software
-
view
804 -
download
0
Transcript of Domain Specific Language with pleasure
MPS
Domain Specific Languageswith pleasure
Václav Pech
JetBrains MPS
High thoughts must have high language.
Aristophanes
Your vocabulary reflects the way you thinkSeth Godin
[Embedded Software]mbeddr
[Data analysis]MetaR
[Business Application]Insurance Configuration Tool
[Business Application]Insurance Configuration Tool
<no variables> <no parent>
<no libraries>
<no business objects>
<no parent>
[Business Application]Insurance Configuration Tool
Notations for DSLs
● Text● Diagrams● Tables● Forms● Mixtures of all● …
The number and the type of the basic colour words of a language determine how one sees the rain bow
Programs are trees
R
A B
C D
G
R
E F
Programs are trees
R
A B
C D
G
R
E F
Children have roles
R
A IfStatement
Expr StmtList
G
R
E F
condition body
References cross the tree
R
Routine def B
Call D
G
R
E F
Languages are sets of concepts
C1
C2C3
Cn
L1
L2
Programs and Languages
R
A B
C D
G
R
E F
C1
C2C3
Cn
L
Models consist of nodes
Meta-models consist of concepts
IntelliJ IDEA inspections
Groovy AST transformations
Groovy AST transformations
There's no life without trees
● Extending IDEs● External DSLs● Internal DSLs in modern languages
● Groovy AST transformations● Scala macros● Lisp, Clojure macros● Lombok
Notations for DSLs
● Text● Diagrams● Tables● Forms● Mixtures of all● …
Parsing is the bottleneck
… of language expressiveness
Editing text
Parsing
Programs are trees
R
A B
C D
G
R
E F
WhileLoop
MethodDef
MethodCall
L IfStatement
Models consist of nodes
Meta-models consist of concepts
Editing trees directly
Projecting
by Jens Nerche @jensnerche
Rich syntaxes
Combine languages
Multiple notations
Parsing is the bottleneck
… of language expressiveness
● Limits the possible syntaxes● Allows only one editable code visualization● Complicates combining languages
Aspects of language definition
● Abstract syntax● Concrete syntax (editor)● Static semantics
● Constraints● Type-system● Dataflow
● Execution semantics / Generator● IDE support
Books
● http://books.campagnelab.org
● http://dslbook.org
https://www.jetbrains.com/mps/publications
Books
● http://books.campagnelab.org
● http://dslbook.org
← He is a Biologist!
https://www.jetbrains.com/mps/publications
The limits of language are the limits of one's worldLudwig Wittgenstein
Questions
Want more?
http://www.jetbrains.com/mps
@vaclav_pech
Image credits
http://www.flickr.com/photos/horiavarlan/4329908160/sizes/m/in/photostream/
http://www.flickr.com/photos/pink_floyd/2409134519/sizes/m/in/photostream/
http://www.flickr.com/photos/atache/4124732863/sizes/m/in/photostream/
http://www.flickr.com/photos/a_ninjamonkey/3294014627/sizes/m/in/photostream/
http://www.flickr.com/photos/carlc/1968636137/
http://www.flickr.com/photos/tasuki/3503304405/sizes/m/in/photostream/
http://www.flickr.com/photos/bmwccgb/5069454884/sizes/m/in/photostream/
http://www.flickr.com/photos/rpmarks/3932013183/sizes/m/in/photostream/
http://www.flickr.com/photos/orqwith/4325166853/
https://www.flickr.com/photos/charlestilford/732688216