SlideShare a Scribd company logo
The Future of DSLs:
Functions and Formal Methods
Markus Völter
voelter@acm.org
www.voelter.de
@markusvoelter
1
The Ancient Past.
2
The World as it is.
Precision
Programming
!=
{
Formulas, Rules
Data Structures
Tables
Values
}
Performance
Scalability
Robustness
Deployment
+ Tests
Data changes.
The Type System supports temporal data natively.
Law changes over the years.
The payroll calculations have to follow.
All languages shown in this talk
are built with the open source
JetBrains MPS language workbench.
MPS Language Workbench
Language Workbench
Open Source, by Jetbrains
Very Expressive
Used for years in industry
Vast Experience
MPS: Notational Freedom
100% crucial for acceptance in domain!
Rabbit Hole
Modeling is more than diagrams!
MPS: Language Composition
SPLE on Language Level!
Language Patterns
New Language
GPL Extension
Existing
Domain Notation
(Informal)
Formalization
Formalized
Language
Reuse GPL incl. Expressions and TS
Add/Embed DS-extensions
Compatible notational style
Reduce to GPL
Analyze Domain to find Abstractions
Define suitable, new notations
Rely on existing behavioral paradigm
Reuse standard expression language
Interpret/Generate to one or more GPLs
Use existing notation from domain
Clean up and formalize
Generate/Interpret
Often import existing „models“
Language Patterns
DSL Development
GPL Extension
Reuse GPL incl. Expressions and TS
Add/Embed DS-extensions
Compatible notational style
Reduce to GPL
An extensible set of integrated languages
for embedded software engineering.
Different kinds of languages, as
illustrated by the different
distributions of aspect code.
DSL Development
New Language
Analyze Domain to find Abstractions
Define suitable, new notations
Rely on existing behavioral paradigm
Reuse standard expression language
Interpret/Generate to one or more GPLs
KernelF
f f f f
f f f f
Specification: mbeddr contracts
Analysis:
Model
Checking
C Code
Specification: KernelF
Analysis: SMT Solving of Expressions
Specification: NuSMV extensions (Dan Ratiu)
Programming vs. MD: Traditionally
Programming vs. MD: What it can be
3
Is this good enough?
Notational Flexibility.
Language Modularity.
Collaboration.
In the Browser.
Semantics Definition.
KernelF
DSL
Java
SMT
Interpreter
*
Notational Flexibility.
Language Modularity.
Collaboration.
In the Browser.
Semantics Definition.
KernelF
DSL
Java
SMT
Interpreter
Not Incremental!
4
Where we go from here.
Shadow Models
Incremental, Realtime
Model Transformations
for MPS
User edits the input model
A delta is propagated into the
transformation engine
A change on the shadow model
is produced
This triggers analysis or update of
results in Shadow Model
Results/messages are lifted back to
input level
Results are annotated to the
input model
Mightbestacked
Shadow Models for DSL Development.
Run incrementally,
basically like in Excel.
Generate to (faster)
Java code
Verify properties
(SMT, Model Checking)
t=1 t=2
t=3 t=4
f f f f
f f f f
f f f f
f f f f
f f f f
f f f f
f f f f
f f f f
t= ...
Execution Paradigms
Functional / Spreadsheet Reactive/Imperative
t
<DEMO>
D
E
M
O
User Level
D
E
M
O
The next code snippet shows a selection of the KernelF2
base language concepts. We define a couple of values and
use various operators and types. Functions, generics and
algebraic data types are demonstrated as well.
D
E
M
O
Some of the expressions, such as true && true or 10 * 20
could be evaluated statically; and indeed, there is a
Shadow Models transformation for the KernelF2 base
language that performs such simplifications:
D
E
M
O
Now we demonstrate language extension and desugaring. This shows three of the
extension constructs defined in the kernelf2.sugar language: enums, alt
expressions and decision tables. These are not part of the core, but defined
in a modular extension; their semantics is defined through a reduction to the
base language. ?maybe? is a Boolean expression that we have added for demo
purposes to avoid making up arbitrary Boolean expressions all the time.
D
E
M
O
Below is the reduced version
of the previous code: enums
become constants that follow
a particular naming
convention, the alt
expression becomes nested
ifs, and the decision table
is translated to nested alt
expressions which are then in
turn reduced to ifs. Notice
how the reduced version
contains errors that are
produced by type checks of
the base language:
declarations must have unique
names and the <!> expression
must never show up. In this
case, <!> is produced by the
transformation because the
decision table has these
?maybe? expressions, so the
type system cannot statically
figure out whether the table
is complete and free from
overlaps.
D
E
M
O
Below we can see an error message in the source model
that is lifted from the shadow. No analysis happens on
the level of the enum declaration itself. Lifting errors
is a core use case for Shadow Models.
D
E
M
O
Implementation
[Simplifications]
D
E
M
O
Here is the entry point to the transformation; it contributes to a predefined
transformation that attaches the results of transformations to the shadow
repository, a Shadow-Models internal data structure that is also visualized
in the IDE. This contribution iterates over all the models in MPS that
contain a Module (the root concept of KernelF2, see examples above) and
transforms each of them through the fork moduleFork. It copies its input
while applying two transformations (declared elsewhere) to a fixpoint.
D
E
M
O
This screenshot shows the simplify transformation. The first entry
declares an abstract transformation from Expr to Expr; the other two
polymorphically override the declaration for the LogicalNotExpr and
the PlusExpr. The former transforms a !true to false and the second
one performs the static addition of number literals.
D
E
M
O
The concrete simplify transformations are defined in the
same language as its abstract declaration; this is not
the case for the desugar transformation. Only the
abstract declaration is specified in the kernelf.core
language, with language extensions expected to provide
the overrides:
D
E
M
O
Implementation
[Enums]
D
E
M
O
Let’s take a look at the reduction of enums to constants. The respective
transformation overrides the desugar transformation for EnumDecls. The
transformation iterates over the literals in the enum, and transforms each of
them into a Constant (note how the rule is allowed to create multiple outputs
as opposed to just one, as defined in the abstract declaration). The name and
the value properties of the created Constant are computed with Java
expressions that access the properties of the input node. The mapping between
the each EnumLiteral and the resulting Constant is stored in the enumLit-
ToConst mapping label.
D
E
M
O
We need two more transformations. First, we have to transform every
EnumType (as in val x: Color = …) into an IntType (val x: int = …),
because all enums are transformed to int constants. And whenever we
reference an enum literal using a EnumLitRef expression, we have to
transform it to a reference to the particular Constant that has been
created from the referenced literal; we can find it by querying the
previously populated label.
D
E
M
O
Implementation
[Error Lifting]
D
E
M
O
Error Lifing relies on detecting particular error messages on output nodes of
the transformation and, if one exists, back-propagating a new error to one or
more of the input nodes. To this end, transformation authors override a
predefined operation liftMessage “inside” the creator of the target node.
Here is the example for the enums:
The operation implementation, written inside the Constant, checks if the
error message(s) reported by MPS on this Constant contain the word
“duplicate”. If so, we propagate a message “this is the duplicate” to the
currently transformed literal, and another error “duplicate literal names” to
the input EnumDecl. The framework takes care automatically of removing the
lifted errors if their causes go away.
D
E
M
O
Implementation
[Alt Expressions]
D
E
M
O
A foldR function joins output for the n-th element of the list to
what has been constructed for the n-1-th list element. In this case,
we create a new if that reuses the condition of the current option
and puts its value into the then part. The else part of the currently
constructed if is whatever the previous iteration has created,
represented by the acc (short for accumulator) expression inside the
foldR. For the first entry in the alt’s list of options, we pass a
seed value to foldR; in our case it is the NeverLit, rendered as <!>.
D
E
M
O
This transformation will create a set of nested ifs, where the last one
always has an <!> in its else part. However, if we look above, the
transformation of the alt expression in the Extensions module did not include
an else <!> at the tail. Why is this? The reason is the otherwise in the last
option, it’s basically a catch-all clause. That last option will be
transformed to by the transformation above:
However, the set of base language simplifications defines one that transforms
an if true to the then part, because we know statically the else option will
never occur:
The case above thus simply becomes 3 and the else <!> goes away. As a
corollary, this means that whenever a <!> is created as the result of the
transformation of an alt expression (and survives simplification), then this
is an indication of an error in the alt expression; which is why we add a
corresponding lifter to the transformation, as can be seen above.
D
E
M
O
IDE Integrations
D
E
M
O
The Shadow Repository in the MPS project view that shows
the results of all transformations; double clicking any
root opens it in an editor, and the incremental
transformations can be observed in realtime.
D
E
M
O
The Fork Explorer shows the execution of the
transformations, including the inputs it processes and
the output nodes it creates.
</DEMO>
5
Status.
Basically works.
Performance Eval
outstanding.
Syntactic simplifications
necessary.
Syntactic
Improvements
„Just Work“ Needs
Research

More Related Content

What's hot

C the basic concepts
C the basic conceptsC the basic concepts
C the basic conceptsAbhinav Vatsa
 
C programming interview questions
C programming interview questionsC programming interview questions
C programming interview questions
adarshynl
 
Top C Language Interview Questions and Answer
Top C Language Interview Questions and AnswerTop C Language Interview Questions and Answer
Top C Language Interview Questions and Answer
Vineet Kumar Saini
 
Fortran 95
Fortran 95Fortran 95
Fortran 95
Zaahir Salam
 
Fortran compiling 2
Fortran compiling 2Fortran compiling 2
Fortran compiling 2
najenssr
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
Wingston
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.pptTareq Hasan
 
What's New In Python 2.5
What's New In Python 2.5What's New In Python 2.5
What's New In Python 2.5
Richard Jones
 
OpenGurukul : Language : C Programming
OpenGurukul : Language : C ProgrammingOpenGurukul : Language : C Programming
OpenGurukul : Language : C Programming
Open Gurukul
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
Dipta Saha
 
Doppl development iteration #1
Doppl development   iteration #1Doppl development   iteration #1
Doppl development iteration #1
Diego Perini
 
Learn C# Programming - Decision Making & Loops
Learn C# Programming - Decision Making & LoopsLearn C# Programming - Decision Making & Loops
Learn C# Programming - Decision Making & Loops
Eng Teong Cheah
 
OOP Poster Presentation
OOP Poster PresentationOOP Poster Presentation
OOP Poster Presentation
Md Mofijul Haque
 
What's New In Python 2.4
What's New In Python 2.4What's New In Python 2.4
What's New In Python 2.4
Richard Jones
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
YOGESH SINGH
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
imtiazalijoono
 
Features of c
Features of cFeatures of c
Features of c
Hitesh Kumar
 

What's hot (20)

C the basic concepts
C the basic conceptsC the basic concepts
C the basic concepts
 
C programming interview questions
C programming interview questionsC programming interview questions
C programming interview questions
 
Top C Language Interview Questions and Answer
Top C Language Interview Questions and AnswerTop C Language Interview Questions and Answer
Top C Language Interview Questions and Answer
 
Fortran 95
Fortran 95Fortran 95
Fortran 95
 
Fortran compiling 2
Fortran compiling 2Fortran compiling 2
Fortran compiling 2
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
 
What's New In Python 2.5
What's New In Python 2.5What's New In Python 2.5
What's New In Python 2.5
 
OpenGurukul : Language : C Programming
OpenGurukul : Language : C ProgrammingOpenGurukul : Language : C Programming
OpenGurukul : Language : C Programming
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
 
Switch case and looping
Switch case and loopingSwitch case and looping
Switch case and looping
 
Doppl development iteration #1
Doppl development   iteration #1Doppl development   iteration #1
Doppl development iteration #1
 
Learn C# Programming - Decision Making & Loops
Learn C# Programming - Decision Making & LoopsLearn C# Programming - Decision Making & Loops
Learn C# Programming - Decision Making & Loops
 
OOP Poster Presentation
OOP Poster PresentationOOP Poster Presentation
OOP Poster Presentation
 
What's New In Python 2.4
What's New In Python 2.4What's New In Python 2.4
What's New In Python 2.4
 
C fundamental
C fundamentalC fundamental
C fundamental
 
c# at f#
c# at f#c# at f#
c# at f#
 
VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1VIT351 Software Development VI Unit1
VIT351 Software Development VI Unit1
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
 
Features of c
Features of cFeatures of c
Features of c
 

Similar to The future of DSLs - functions and formal methods

Opps concept
Opps conceptOpps concept
Opps concept
divyalakshmi77
 
COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis: COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis:
Jyothishmathi Institute of Technology and Science Karimnagar
 
Sprouting into the world of Elm
Sprouting into the world of ElmSprouting into the world of Elm
Sprouting into the world of Elm
Mike Onslow
 
Matlab-3.pptx
Matlab-3.pptxMatlab-3.pptx
Matlab-3.pptx
aboma2hawi
 
Embedded c
Embedded cEmbedded c
Embedded c
Nandan Desai
 
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDY
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDYC UNIT-2 PREPARED Y M V BRAHMANANDA REDDY
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDYRajeshkumar Reddy
 
Password protected diary
Password protected diaryPassword protected diary
Password protected diary
SHARDA SHARAN
 
Maxbox starter
Maxbox starterMaxbox starter
Maxbox starter
Max Kleiner
 
MDE=Model Driven Everything (Spanish Eclipse Day 2009)
MDE=Model Driven Everything (Spanish Eclipse Day 2009)MDE=Model Driven Everything (Spanish Eclipse Day 2009)
MDE=Model Driven Everything (Spanish Eclipse Day 2009)
Jordi Cabot
 
F# 101
F# 101F# 101
F# 101
Chris Alcock
 
JavaScript: Core Part
JavaScript: Core PartJavaScript: Core Part
JavaScript: Core Part
維佋 唐
 
Matlab for diploma students(1)
Matlab for diploma students(1)Matlab for diploma students(1)
Matlab for diploma students(1)
Retheesh Raj
 
C Language Presentation.pptx
C Language Presentation.pptxC Language Presentation.pptx
C Language Presentation.pptx
PradeepKumar206701
 
Data services-functions
Data services-functionsData services-functions
Data services-functions
Durga Venkatesh
 
1588147798Begining_ABUAD1.pdf
1588147798Begining_ABUAD1.pdf1588147798Begining_ABUAD1.pdf
1588147798Begining_ABUAD1.pdf
SemsemSameer1
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
sajjad ali khan
 
Epsilon
EpsilonEpsilon
Functional programming in TypeScript
Functional programming in TypeScriptFunctional programming in TypeScript
Functional programming in TypeScript
binDebug WorkSpace
 

Similar to The future of DSLs - functions and formal methods (20)

Opps concept
Opps conceptOpps concept
Opps concept
 
COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis: COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis:
 
Sprouting into the world of Elm
Sprouting into the world of ElmSprouting into the world of Elm
Sprouting into the world of Elm
 
Matlab-3.pptx
Matlab-3.pptxMatlab-3.pptx
Matlab-3.pptx
 
Embedded c
Embedded cEmbedded c
Embedded c
 
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDY
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDYC UNIT-2 PREPARED Y M V BRAHMANANDA REDDY
C UNIT-2 PREPARED Y M V BRAHMANANDA REDDY
 
Password protected diary
Password protected diaryPassword protected diary
Password protected diary
 
Maxbox starter
Maxbox starterMaxbox starter
Maxbox starter
 
MDE=Model Driven Everything (Spanish Eclipse Day 2009)
MDE=Model Driven Everything (Spanish Eclipse Day 2009)MDE=Model Driven Everything (Spanish Eclipse Day 2009)
MDE=Model Driven Everything (Spanish Eclipse Day 2009)
 
F# 101
F# 101F# 101
F# 101
 
JavaScript: Core Part
JavaScript: Core PartJavaScript: Core Part
JavaScript: Core Part
 
Matlab for diploma students(1)
Matlab for diploma students(1)Matlab for diploma students(1)
Matlab for diploma students(1)
 
C Language Presentation.pptx
C Language Presentation.pptxC Language Presentation.pptx
C Language Presentation.pptx
 
Data services-functions
Data services-functionsData services-functions
Data services-functions
 
Final requirement
Final requirementFinal requirement
Final requirement
 
1588147798Begining_ABUAD1.pdf
1588147798Begining_ABUAD1.pdf1588147798Begining_ABUAD1.pdf
1588147798Begining_ABUAD1.pdf
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
 
Epsilon
EpsilonEpsilon
Epsilon
 
Functional programming in TypeScript
Functional programming in TypeScriptFunctional programming in TypeScript
Functional programming in TypeScript
 
Operators
OperatorsOperators
Operators
 

More from Markus Voelter

Consulting
ConsultingConsulting
Consulting
Markus Voelter
 
Build your own Language - Why and How?
Build your own Language - Why and How?Build your own Language - Why and How?
Build your own Language - Why and How?
Markus Voelter
 
Deklarative Smart Contracts
Deklarative Smart ContractsDeklarative Smart Contracts
Deklarative Smart Contracts
Markus Voelter
 
Using language workbenches and domain-specific languages for safety-critical ...
Using language workbenches and domain-specific languages for safety-critical ...Using language workbenches and domain-specific languages for safety-critical ...
Using language workbenches and domain-specific languages for safety-critical ...
Markus Voelter
 
What's Missing in Language Workbenches
What's Missing in Language WorkbenchesWhat's Missing in Language Workbenches
What's Missing in Language Workbenches
Markus Voelter
 
How Domains Shape Languages
 How Domains Shape Languages How Domains Shape Languages
How Domains Shape Languages
Markus Voelter
 
Why Modeling Suck Sucks
Why Modeling Suck SucksWhy Modeling Suck Sucks
Why Modeling Suck Sucks
Markus Voelter
 
Fusing Modeling and Programming into Language-Oriented Programming
Fusing Modeling and Programming into Language-Oriented ProgrammingFusing Modeling and Programming into Language-Oriented Programming
Fusing Modeling and Programming into Language-Oriented Programming
Markus Voelter
 
Lessons Learned from building mbeddr
Lessons Learned from building mbeddrLessons Learned from building mbeddr
Lessons Learned from building mbeddr
Markus Voelter
 
The Design, Evolution and Use of KernelF
The Design, Evolution and Use of KernelFThe Design, Evolution and Use of KernelF
The Design, Evolution and Use of KernelF
Markus Voelter
 
Envisioning the Future of Language Workbenches
Envisioning the Future of Language WorkbenchesEnvisioning the Future of Language Workbenches
Envisioning the Future of Language Workbenches
Markus Voelter
 
Architecting Domain-Specific Languages
Architecting Domain-Specific LanguagesArchitecting Domain-Specific Languages
Architecting Domain-Specific Languages
Markus Voelter
 
Generic Tools - Specific Languages (PhD Defense Slides)
Generic Tools - Specific Languages (PhD Defense Slides)Generic Tools - Specific Languages (PhD Defense Slides)
Generic Tools - Specific Languages (PhD Defense Slides)
Markus Voelter
 
Language-Oriented Business Applications
Language-Oriented Business ApplicationsLanguage-Oriented Business Applications
Language-Oriented Business Applications
Markus Voelter
 
Generic Tools, Specific Laguages
Generic Tools, Specific LaguagesGeneric Tools, Specific Laguages
Generic Tools, Specific Laguages
Markus Voelter
 
Domain Specific Language Design
Domain Specific Language DesignDomain Specific Language Design
Domain Specific Language DesignMarkus Voelter
 
From Programming to Modeling And Back Again
From Programming to Modeling And Back AgainFrom Programming to Modeling And Back Again
From Programming to Modeling And Back Again
Markus Voelter
 
Faszination Segelfliegen
Faszination SegelfliegenFaszination Segelfliegen
Faszination Segelfliegen
Markus Voelter
 
Introduction To MDD
Introduction To MDDIntroduction To MDD
Introduction To MDD
Markus Voelter
 
Professional Podcasting Guide
Professional Podcasting GuideProfessional Podcasting Guide
Professional Podcasting Guide
Markus Voelter
 

More from Markus Voelter (20)

Consulting
ConsultingConsulting
Consulting
 
Build your own Language - Why and How?
Build your own Language - Why and How?Build your own Language - Why and How?
Build your own Language - Why and How?
 
Deklarative Smart Contracts
Deklarative Smart ContractsDeklarative Smart Contracts
Deklarative Smart Contracts
 
Using language workbenches and domain-specific languages for safety-critical ...
Using language workbenches and domain-specific languages for safety-critical ...Using language workbenches and domain-specific languages for safety-critical ...
Using language workbenches and domain-specific languages for safety-critical ...
 
What's Missing in Language Workbenches
What's Missing in Language WorkbenchesWhat's Missing in Language Workbenches
What's Missing in Language Workbenches
 
How Domains Shape Languages
 How Domains Shape Languages How Domains Shape Languages
How Domains Shape Languages
 
Why Modeling Suck Sucks
Why Modeling Suck SucksWhy Modeling Suck Sucks
Why Modeling Suck Sucks
 
Fusing Modeling and Programming into Language-Oriented Programming
Fusing Modeling and Programming into Language-Oriented ProgrammingFusing Modeling and Programming into Language-Oriented Programming
Fusing Modeling and Programming into Language-Oriented Programming
 
Lessons Learned from building mbeddr
Lessons Learned from building mbeddrLessons Learned from building mbeddr
Lessons Learned from building mbeddr
 
The Design, Evolution and Use of KernelF
The Design, Evolution and Use of KernelFThe Design, Evolution and Use of KernelF
The Design, Evolution and Use of KernelF
 
Envisioning the Future of Language Workbenches
Envisioning the Future of Language WorkbenchesEnvisioning the Future of Language Workbenches
Envisioning the Future of Language Workbenches
 
Architecting Domain-Specific Languages
Architecting Domain-Specific LanguagesArchitecting Domain-Specific Languages
Architecting Domain-Specific Languages
 
Generic Tools - Specific Languages (PhD Defense Slides)
Generic Tools - Specific Languages (PhD Defense Slides)Generic Tools - Specific Languages (PhD Defense Slides)
Generic Tools - Specific Languages (PhD Defense Slides)
 
Language-Oriented Business Applications
Language-Oriented Business ApplicationsLanguage-Oriented Business Applications
Language-Oriented Business Applications
 
Generic Tools, Specific Laguages
Generic Tools, Specific LaguagesGeneric Tools, Specific Laguages
Generic Tools, Specific Laguages
 
Domain Specific Language Design
Domain Specific Language DesignDomain Specific Language Design
Domain Specific Language Design
 
From Programming to Modeling And Back Again
From Programming to Modeling And Back AgainFrom Programming to Modeling And Back Again
From Programming to Modeling And Back Again
 
Faszination Segelfliegen
Faszination SegelfliegenFaszination Segelfliegen
Faszination Segelfliegen
 
Introduction To MDD
Introduction To MDDIntroduction To MDD
Introduction To MDD
 
Professional Podcasting Guide
Professional Podcasting GuideProfessional Podcasting Guide
Professional Podcasting Guide
 

Recently uploaded

Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 

Recently uploaded (20)

Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 

The future of DSLs - functions and formal methods

  • 1. The Future of DSLs: Functions and Formal Methods Markus Völter voelter@acm.org www.voelter.de @markusvoelter
  • 3. 2 The World as it is.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. Data changes. The Type System supports temporal data natively.
  • 14.
  • 15. Law changes over the years. The payroll calculations have to follow.
  • 16.
  • 17. All languages shown in this talk are built with the open source JetBrains MPS language workbench.
  • 18. MPS Language Workbench Language Workbench Open Source, by Jetbrains Very Expressive Used for years in industry Vast Experience
  • 19. MPS: Notational Freedom 100% crucial for acceptance in domain! Rabbit Hole Modeling is more than diagrams!
  • 20. MPS: Language Composition SPLE on Language Level!
  • 21.
  • 22. Language Patterns New Language GPL Extension Existing Domain Notation (Informal) Formalization Formalized Language Reuse GPL incl. Expressions and TS Add/Embed DS-extensions Compatible notational style Reduce to GPL Analyze Domain to find Abstractions Define suitable, new notations Rely on existing behavioral paradigm Reuse standard expression language Interpret/Generate to one or more GPLs Use existing notation from domain Clean up and formalize Generate/Interpret Often import existing „models“ Language Patterns
  • 23.
  • 24. DSL Development GPL Extension Reuse GPL incl. Expressions and TS Add/Embed DS-extensions Compatible notational style Reduce to GPL
  • 25. An extensible set of integrated languages for embedded software engineering.
  • 26. Different kinds of languages, as illustrated by the different distributions of aspect code.
  • 27. DSL Development New Language Analyze Domain to find Abstractions Define suitable, new notations Rely on existing behavioral paradigm Reuse standard expression language Interpret/Generate to one or more GPLs KernelF f f f f f f f f
  • 28.
  • 29.
  • 30.
  • 32. Specification: KernelF Analysis: SMT Solving of Expressions
  • 34.
  • 35. Programming vs. MD: Traditionally
  • 36. Programming vs. MD: What it can be
  • 37.
  • 38. 3 Is this good enough?
  • 39. Notational Flexibility. Language Modularity. Collaboration. In the Browser. Semantics Definition. KernelF DSL Java SMT Interpreter *
  • 40. Notational Flexibility. Language Modularity. Collaboration. In the Browser. Semantics Definition. KernelF DSL Java SMT Interpreter Not Incremental!
  • 41. 4 Where we go from here.
  • 42. Shadow Models Incremental, Realtime Model Transformations for MPS
  • 43. User edits the input model A delta is propagated into the transformation engine A change on the shadow model is produced This triggers analysis or update of results in Shadow Model Results/messages are lifted back to input level Results are annotated to the input model Mightbestacked
  • 44. Shadow Models for DSL Development. Run incrementally, basically like in Excel. Generate to (faster) Java code Verify properties (SMT, Model Checking)
  • 45. t=1 t=2 t=3 t=4 f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f f t= ... Execution Paradigms Functional / Spreadsheet Reactive/Imperative t
  • 48. D E M O The next code snippet shows a selection of the KernelF2 base language concepts. We define a couple of values and use various operators and types. Functions, generics and algebraic data types are demonstrated as well.
  • 49. D E M O Some of the expressions, such as true && true or 10 * 20 could be evaluated statically; and indeed, there is a Shadow Models transformation for the KernelF2 base language that performs such simplifications:
  • 50. D E M O Now we demonstrate language extension and desugaring. This shows three of the extension constructs defined in the kernelf2.sugar language: enums, alt expressions and decision tables. These are not part of the core, but defined in a modular extension; their semantics is defined through a reduction to the base language. ?maybe? is a Boolean expression that we have added for demo purposes to avoid making up arbitrary Boolean expressions all the time.
  • 51. D E M O Below is the reduced version of the previous code: enums become constants that follow a particular naming convention, the alt expression becomes nested ifs, and the decision table is translated to nested alt expressions which are then in turn reduced to ifs. Notice how the reduced version contains errors that are produced by type checks of the base language: declarations must have unique names and the <!> expression must never show up. In this case, <!> is produced by the transformation because the decision table has these ?maybe? expressions, so the type system cannot statically figure out whether the table is complete and free from overlaps.
  • 52. D E M O Below we can see an error message in the source model that is lifted from the shadow. No analysis happens on the level of the enum declaration itself. Lifting errors is a core use case for Shadow Models.
  • 54. D E M O Here is the entry point to the transformation; it contributes to a predefined transformation that attaches the results of transformations to the shadow repository, a Shadow-Models internal data structure that is also visualized in the IDE. This contribution iterates over all the models in MPS that contain a Module (the root concept of KernelF2, see examples above) and transforms each of them through the fork moduleFork. It copies its input while applying two transformations (declared elsewhere) to a fixpoint.
  • 55. D E M O This screenshot shows the simplify transformation. The first entry declares an abstract transformation from Expr to Expr; the other two polymorphically override the declaration for the LogicalNotExpr and the PlusExpr. The former transforms a !true to false and the second one performs the static addition of number literals.
  • 56. D E M O The concrete simplify transformations are defined in the same language as its abstract declaration; this is not the case for the desugar transformation. Only the abstract declaration is specified in the kernelf.core language, with language extensions expected to provide the overrides:
  • 58. D E M O Let’s take a look at the reduction of enums to constants. The respective transformation overrides the desugar transformation for EnumDecls. The transformation iterates over the literals in the enum, and transforms each of them into a Constant (note how the rule is allowed to create multiple outputs as opposed to just one, as defined in the abstract declaration). The name and the value properties of the created Constant are computed with Java expressions that access the properties of the input node. The mapping between the each EnumLiteral and the resulting Constant is stored in the enumLit- ToConst mapping label.
  • 59. D E M O We need two more transformations. First, we have to transform every EnumType (as in val x: Color = …) into an IntType (val x: int = …), because all enums are transformed to int constants. And whenever we reference an enum literal using a EnumLitRef expression, we have to transform it to a reference to the particular Constant that has been created from the referenced literal; we can find it by querying the previously populated label.
  • 61. D E M O Error Lifing relies on detecting particular error messages on output nodes of the transformation and, if one exists, back-propagating a new error to one or more of the input nodes. To this end, transformation authors override a predefined operation liftMessage “inside” the creator of the target node. Here is the example for the enums: The operation implementation, written inside the Constant, checks if the error message(s) reported by MPS on this Constant contain the word “duplicate”. If so, we propagate a message “this is the duplicate” to the currently transformed literal, and another error “duplicate literal names” to the input EnumDecl. The framework takes care automatically of removing the lifted errors if their causes go away.
  • 63. D E M O A foldR function joins output for the n-th element of the list to what has been constructed for the n-1-th list element. In this case, we create a new if that reuses the condition of the current option and puts its value into the then part. The else part of the currently constructed if is whatever the previous iteration has created, represented by the acc (short for accumulator) expression inside the foldR. For the first entry in the alt’s list of options, we pass a seed value to foldR; in our case it is the NeverLit, rendered as <!>.
  • 64. D E M O This transformation will create a set of nested ifs, where the last one always has an <!> in its else part. However, if we look above, the transformation of the alt expression in the Extensions module did not include an else <!> at the tail. Why is this? The reason is the otherwise in the last option, it’s basically a catch-all clause. That last option will be transformed to by the transformation above: However, the set of base language simplifications defines one that transforms an if true to the then part, because we know statically the else option will never occur: The case above thus simply becomes 3 and the else <!> goes away. As a corollary, this means that whenever a <!> is created as the result of the transformation of an alt expression (and survives simplification), then this is an indication of an error in the alt expression; which is why we add a corresponding lifter to the transformation, as can be seen above.
  • 66. D E M O The Shadow Repository in the MPS project view that shows the results of all transformations; double clicking any root opens it in an editor, and the incremental transformations can be observed in realtime.
  • 67. D E M O The Fork Explorer shows the execution of the transformations, including the inputs it processes and the output nodes it creates.