architecting domain-specific languages
DESCRIPTION
Architecture DSLs are a useful tool to capture the cornerstones of platform or product line architectures. In addition, interesting analyses can be performed on the models, and much of the infrastructure and configuration code can be generated. On the flip side, these DSLs themselves must be architected consciously: while many architectural abstractions are specific to any given platform or product line, many other aspects are generic and hence can be reused for several architecture DSLs. In this talk I trace how my thinking on architecture modeling has changed over time, and how this is reflected in the architecture DSLs I have built (or helped to build), and how evolving tools have made these changes possible.TRANSCRIPT
![Page 2: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/2.jpg)
0Introduction
![Page 3: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/3.jpg)
more in GPLs more in DSLDomain Size large and complex smaller and well-defined
Designed by guru or committee a few engineers and domain experts
Language Size large small
Turing-completeness
almost always often not
User Community large, anonymous and widespread
small, accessible and local
In-language abstraction
sophisticated limited
Lifespan years to decades months to years (driven by context)
Evolution slow, often standardized fast-paced
Incompatible Changes
almost impossible feasible
![Page 4: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/4.jpg)
C
LEGO Robot Control
Components
State Machines
Sensor Access
General Purpose
Domain Specific
![Page 5: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/5.jpg)
1Case Study:
mbeddr
![Page 6: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/6.jpg)
An extensible set of integrated languagesfor embedded software engineering.
„ “Specific Languages
![Page 7: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/7.jpg)
![Page 8: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/8.jpg)
Open Source @ eclipse.orgEclipse Public License 1.0http://mbeddr.com
![Page 9: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/9.jpg)
itemis France: Smart Meter
First significant mbeddr projectca. 100,000 LoCabout to be finishedgreat modularity due to componentsuses physical units extensivelygreat test coverage due to special extensions
![Page 10: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/10.jpg)
ACCEnTControl.Lab
![Page 11: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/11.jpg)
20+ Projects in various stages
by various “Big Name” companies.
Branching into other domains
insurance, financial, tax
![Page 12: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/12.jpg)
Open SourceApache 2.0http://jetbrains.com/mps
![Page 13: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/13.jpg)
[Language Workbench]
+ Refactorings, Find Usages, Syntax Coloring, Debugging, ...
![Page 14: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/14.jpg)
Parsing Projectional Editing
[Projectional Editing]
![Page 15: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/15.jpg)
Regular Code/Text Mathematical
Tables Graphical
Syntactic Flexibility[Projectional Editing]
![Page 16: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/16.jpg)
L2 L1
Separate Files In One File
Type SystemTransformationConstraints
Type SystemTransformationConstraintsSyntaxIDE
Language Composition[Projectional Editing]
![Page 17: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/17.jpg)
2Expressivity
![Page 18: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/18.jpg)
Shorter Programs
More Accessible Semantics
![Page 19: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/19.jpg)
For a limitedDomain!
Domain Knowledge
encapsulated in language
![Page 20: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/20.jpg)
Smaller Domain
More Specialized Language
Shorter Programs
![Page 21: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/21.jpg)
Ѱ
The do-what-I-want
language
![Page 22: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/22.jpg)
Ѱ
Single Program vs. Class/Domain
No Variability!
![Page 23: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/23.jpg)
Domain Hierarchy
more specialized domainsmore specialized languages
![Page 24: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/24.jpg)
Reification
Dn
Dn+1
==
![Page 25: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/25.jpg)
Reification
==Language Definition
Transformation/Generation
![Page 26: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/26.jpg)
C Extensions
![Page 27: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/27.jpg)
Requirements
![Page 28: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/28.jpg)
Linguistic Abstraction
In-LanguageAbstractionLibrariesClassesFrameworks
![Page 29: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/29.jpg)
Linguistic Abstraction
In-LanguageAbstractionUser-DefinableSimpler Language
AnalyzableBetter IDE Support
![Page 30: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/30.jpg)
FunctionsComponents
![Page 31: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/31.jpg)
Linguistic Abstraction
In-LanguageAbstractionUser-DefinableSimpler Language
AnalyzableBetter IDE Support
Special Treatment!
![Page 32: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/32.jpg)
Linguistic Abstraction
In-LanguageAbstraction
Std Lib
![Page 33: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/33.jpg)
Block Library
![Page 34: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/34.jpg)
Unique State Names
Unreachable States
Dead End States
Guard Decidability
Exhaustive Search, Proof!
Reachability
![Page 35: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/35.jpg)
Component VerificationSM Model Checking
![Page 36: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/36.jpg)
3Notation
![Page 37: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/37.jpg)
UI for the language!Important for acceptance by users!
TextualProseSymbolic/MathTabularGraphical
![Page 38: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/38.jpg)
Reuse existing syntax of domain, if any!
Tools let you freely combine all kinds.
![Page 39: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/39.jpg)
Reuse existing syntax of domain, if any!
![Page 40: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/40.jpg)
State Machine TablesMath
Component WiringProseTraces
![Page 41: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/41.jpg)
4Type System
![Page 42: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/42.jpg)
Static Semantics
Execution Semantics
![Page 43: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/43.jpg)
Static Semantics
Execution Semantics
![Page 44: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/44.jpg)
Static Semantics
ConstraintsType Systems
![Page 45: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/45.jpg)
Unique State Names
Unreachable States
Dead End States
…
Extended C
Example
![Page 46: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/46.jpg)
Unique State Names
Unreachable States
Dead End States
…
Easier to do on a declarative Level!
Extended C
Example
![Page 47: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/47.jpg)
Unique State Names
Unreachable States
Dead End States
…
Easier to do on a declarative Level!
Thinking of all constraints is a coverage problem! Exten
ded C
Example
![Page 48: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/48.jpg)
Assign fixed types
Derive TypesCalculate Common Types
Check Type Consistency
What does a type system do?
![Page 49: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/49.jpg)
Intent +Check
Derive
More code
Better error messages
Better Performance
More convenient
More complex checkers
Harder to understand for users
![Page 50: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/50.jpg)
Classical C TypesClosures
![Page 51: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/51.jpg)
5Execution
![Page 52: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/52.jpg)
Def: Semantics… via mapping to lower level
OB: Observable Behaviour (Test Cases)
![Page 53: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/53.jpg)
Def: Semantics… via mapping to lower level
LD
LD-1
TransformationInterpretation
![Page 54: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/54.jpg)
Dn
Dn+1
Transformation
![Page 55: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/55.jpg)
LD
LD-1
Transformation
Known Semantics!
Transformation
![Page 56: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/56.jpg)
LD
LD-1
TransformationCorrect!?
Transformation
![Page 57: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/57.jpg)
Transformation
LD
LD-1
Transformation
Tests (D)
Tests (D-1)
Run tests on both levels; all pass.Coverage Problem!
![Page 58: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/58.jpg)
mbeddr Tests
![Page 59: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/59.jpg)
Multi-Stage
L3
L2
L1
L0
Modularization
![Page 60: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/60.jpg)
Multi-Stage: Reuse
L3
L2
L1
L0
Reusing Later Stages
Optimizations!
L5
![Page 61: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/61.jpg)
Multi-Stage: Reuse
L3
L2
L1
L0
L5
Extended C
Example
C Text
C (MPS tree)
State Machine
Components
Robot Control
![Page 62: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/62.jpg)
Multi-Stage: Reuse
L3
L2
L1
L0
L5
Extended C
Example
C Text
C (MPS tree)
State Machine
Components
Robot Control
SyntacticCorrectness, Headers
C Type System
ConsistencyModel Checking
Efficient Mappings
![Page 63: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/63.jpg)
Multi-Stage: Reuse
L3
L2
L1
L0
L1b
L0b
Reusing Early Stages
Portability
![Page 64: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/64.jpg)
Multi-Stage: Reuse
L3
L2
L1
L0
L1b
L0b Extended C
Example
JavaC#
![Page 65: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/65.jpg)
Mock Components
![Page 66: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/66.jpg)
Multi-Stage: Preprocess
Adding an optional, modular
emergencystop feature
![Page 67: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/67.jpg)
Composite Blocks Transformation
![Page 68: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/68.jpg)
Platform
![Page 69: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/69.jpg)
No Platform
![Page 70: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/70.jpg)
A program at D0 thatacts on the structureof an input program at D>0
Interpretation
![Page 71: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/71.jpg)
Transformation Interpretation
+ Code Inspection
+ Debugging
+ Performance & Optimization
+ Platform Con- formance
![Page 72: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/72.jpg)
EssentiallyEverything :-)
![Page 73: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/73.jpg)
Transformation Interpretation
+ Code Inspection
+ Debugging
+ Performance & Optimization
+ Platform Con- formance
+ Turnaround Time
+ Runtime Change
![Page 74: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/74.jpg)
Business Rulesin Requirements
![Page 75: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/75.jpg)
Def: Semantics… via mapping to lower level
LD
LD-1
TransformationInterpretation
![Page 76: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/76.jpg)
Multiple Mappings… at the same time
LD
Lx Ly Lz
Similar Semantics?
T
T T Tall green!
![Page 77: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/77.jpg)
Multiple Mappings… at the same time
LD
Lx Ly Lz
Similar Semantics?
T
T T Tall green!
![Page 78: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/78.jpg)
Multiple Mappings… alternatively, selectably
LD
Lx Ly Lz
Extend LD to include explicit data that determines transformation
![Page 79: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/79.jpg)
LD
Lx Ly Lz
External Data: - Switches- Annotation Model
Multiple Mappings… alternatively, selectably
![Page 80: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/80.jpg)
Build ConfigComp Static Wiring
![Page 81: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/81.jpg)
6Separationof Concerns
![Page 82: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/82.jpg)
Several Concerns… in one domain
![Page 83: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/83.jpg)
Several Concerns… in one domain
integrated intoone fragment
separated intoseveral fragments
![Page 84: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/84.jpg)
Components +Instances
![Page 85: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/85.jpg)
Viewpoints
independent
dependent
![Page 86: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/86.jpg)
Viewpoints: Why?
Sufficiency
Different Stakeholders
Different Steps in Process – VCS unit!
![Page 87: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/87.jpg)
SeparateRequirements
![Page 88: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/88.jpg)
Viewpoints
sufficient?
contains allthe data for running a meaningfultransformation
independent
![Page 89: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/89.jpg)
Viewpoints: Why?
1:n Relationships
![Page 90: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/90.jpg)
Viewpoints
Well-defined Dependencies
No Cycles!
Avoid Synchronization!(unless you use a projectional editor)
![Page 91: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/91.jpg)
Sync in Comp + Interfaces
![Page 92: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/92.jpg)
7Completeness
![Page 93: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/93.jpg)
Can you generate 100% of the code from the DSL program?
More generally: all of D-1
![Page 94: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/94.jpg)
Incomplete: What to do?
FD
FD-1OB(FD) !=
![Page 95: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/95.jpg)
Incomplete: What to do?
FD
FD-1
+ FD-1,
man
OB(FD) ==
Manually written code!
![Page 96: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/96.jpg)
Manually written code?
Call “black box” code (foreign functions)
![Page 97: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/97.jpg)
State MachineEvent Functions
![Page 98: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/98.jpg)
Manually written code?
Call “black box” code (foreign functions)
Embed LD-1 code in LD program
![Page 99: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/99.jpg)
All of mbeddr
![Page 100: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/100.jpg)
Manually written code?
Call “black box” code (foreign functions)
Embed LD-1 code in LD program
Use composition mechanisms of LD-1 (inheritance, patterns, aspects, …)
![Page 101: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/101.jpg)
Manually written code?
Call “black box” code (foreign functions)
Embed LD-1 code in LD program
Use composition mechanisms of LD-1 (inheritance, patterns, aspects, …)
Use protected regions (if you really have to…)
![Page 102: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/102.jpg)
Manually written code?
Call “black box” code (foreign functions)
Embed LD-1 code in LD program
Use composition mechanisms of LD-1 (inheritance, patterns, aspects, …)
Use protected regions (if you really have to…) DON’T!
![Page 103: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/103.jpg)
Roundtripping
LD
LD-1
L’D-
1
L’D
………
![Page 104: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/104.jpg)
Roundtripping – Don’t!
LD
LD-1
L’D-
1
L’D
………
Semantic Recovery!
![Page 105: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/105.jpg)
8Fundamental
Paradigms
![Page 106: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/106.jpg)
Structure
Modularization, VisibilityNamespaces,public/privateimporting
![Page 107: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/107.jpg)
Structure
Modularization, Visibility
divide & conquerreusestakeholder integration
Namespaces,public/privateimporting
![Page 108: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/108.jpg)
mbeddr Chunks
![Page 109: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/109.jpg)
Structure
Partitioning (Files)
VCS UnitUnit of sharingUnit of IP
!= logical modulesmay influence language design
![Page 110: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/110.jpg)
MPS models
![Page 111: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/111.jpg)
Structure
Spec vs. Implementationplug in different Implsdifferent stakeholders
![Page 112: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/112.jpg)
Interfaces +Components
![Page 113: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/113.jpg)
Structure
SpecializationLiskov substitution Pleaving holes (“abstract”)
![Page 114: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/114.jpg)
Structure
SpecializationLiskov substitution Pleaving holes (“abstract”)
variants (in space)evolution (over time)
![Page 115: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/115.jpg)
ComponentsPolymorphism
![Page 116: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/116.jpg)
Behavior
Not all DSLs specify behavior
Some just declare behavior
This section is not for those!
![Page 117: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/117.jpg)
Behavior
Imperativesequence of statementschanges program state
write understand
debug
analyze performance
simple simple - simple (step)
hard good
![Page 118: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/118.jpg)
C
![Page 119: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/119.jpg)
Behavior
Functionalfunctions call other functions.no state. No aliasing.
write understand
debug
analyze performance
simple - simple simple (tree)
good good -
![Page 120: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/120.jpg)
ACCENT Blocks
![Page 121: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/121.jpg)
Behavior
Functionalpure expressions are a subset of functional(operators hard-wired)
guardspreconditionsderived attributes
![Page 122: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/122.jpg)
Business Rules –Debugging
![Page 123: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/123.jpg)
Behavior
Declarativeonly facts and goals. no control flow.eval engine, solver (several)
write understand
debug
analyze performance
simple simple - hard depends often bad
![Page 124: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/124.jpg)
Behavior
Declarativeconcurrencyconstraint programmingsolvinglogic programming
![Page 125: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/125.jpg)
Typing Rules
![Page 126: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/126.jpg)
Behavior
Data Flow
chained blocks consume continuous data that flows from block to block
write understand debug
analyze performance
simple - simple/hard hard simple can be good
![Page 127: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/127.jpg)
Behavior
Data Flow
continuous, calc on changequantized, calc on new datatime triggered, calc every x
![Page 128: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/128.jpg)
Behavior
Data Flow
Embedded ProgrammingEnterprise ETL & CEP
![Page 129: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/129.jpg)
ACCENT Blocks
![Page 130: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/130.jpg)
Behavior
State Based
states, transitions, guards, reactions
write understand debug
analyze performance
simple - simple/hard s/h simple +
can be good
event driven, timed
![Page 131: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/131.jpg)
State Machines
![Page 132: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/132.jpg)
Behavior
Combinationsdata flow uses functional, imperative or declarative lang inside block
![Page 133: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/133.jpg)
Behavior
Combinationsstate machines use expressions in guards and often an imperative lang in actions
![Page 134: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/134.jpg)
9Modularity
![Page 135: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/135.jpg)
BehaviorLanguage Modularity, Composition and Reuse (LMR&C)
increase efficiency of DSL development
ReferencingReuseExtensionReuse
4 ways of composition:
![Page 136: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/136.jpg)
BehaviorLanguage Modularity, Composition and Reuse (LMR&C)
increase efficiency of DSL development
distinguished regardingdependencies and fragmentstructure
4 ways of composition:
![Page 137: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/137.jpg)
BehaviorDependencies:
do we have to know about the reuse when designing the languages?
homogeneous vs. heterogeneous(„mixing languages“)
Fragment Structure:
![Page 138: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/138.jpg)
BehaviorDependencies &Fragment Structure:
![Page 139: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/139.jpg)
BehaviorDependencies &Fragment Structure:
![Page 140: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/140.jpg)
ReferencingReferencing
![Page 141: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/141.jpg)
Referencing
Dependent
No containment
Referencing
![Page 142: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/142.jpg)
Used in Viewpoints
Referencing
![Page 143: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/143.jpg)
Extension
![Page 144: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/144.jpg)
Containment
Dependent
Extension
![Page 145: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/145.jpg)
more specialized domainsmore specialized languages
ExtensionExtension
![Page 146: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/146.jpg)
Dn
Dn+1
==
Extension
![Page 147: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/147.jpg)
Dn
Dn+1
==
Extension
![Page 148: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/148.jpg)
Dn
==
Good for bottom-up (inductive) domains, and for use by technical DSLs (people)
Extension
![Page 149: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/149.jpg)
BehaviorDrawbacks
tightly bound to basepotentially hard to analyze the combined program
Extension
![Page 150: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/150.jpg)
Embedding
![Page 151: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/151.jpg)
EmbeddingEmbedding
![Page 152: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/152.jpg)
Containment
Independent
Embedding
![Page 153: Architecting Domain-Specific Languages](https://reader033.vdocuments.us/reader033/viewer/2022052622/559220fb1a28abd5598b46d5/html5/thumbnails/153.jpg)
Units in State Machines