SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Downloaden Sie, um offline zu lesen
KernelF
Turku Centre for Computer Science
Mikhail Barash
Åbo Akademi Finland
a functional core
@mikhail_barash
for DSLs
Domain-Specific
Languages
1997
John, CEO publishing company
left right
top bottom
1
page enumeration
margins
single page
range
open interval
20..30
40-
measurement units
mm cm inches
1999
Hi,
We've just got new order, diary No: 1999/3456/32-A.
It's books, covers 250g/m2.
Left: 30 mm
Top: 15 mm
Right: 20 mm
Bottom: 1 in
Thanks,
secretary typesetter
some structure
2000
Jane, developer
typesetter developer
2001
start marker
end marker
row: start.row + 1
col: start.col + 6
row: start.row + 4
col: start.col + 8
error messages
typesetter
2002
1,2,20-30,40-
implemented “manually”error messages
2003
error messages
typesetter
developer
2007
typesetter
developer
cryptic error messages
DSL
without tailored IDE
will not
be used
2010s
Language workbenches
requires parsingtextual DSL
automates definition of languageslanguage workbench
implementing IDE is tedious
vital for adoption and success of languageIDE
automates creation of IDEs for languages
IDEA-level custom IDE
rich notation
custom auto complete
intentions (quick fixes)
domain-specific error messages
key representation of program abstract syntax tree (AST)
can be projected into different representations
text diagrams tables forms
textual form of code only meant for the programmer
but it is unambiguous
can look ambiguous
no parsing needed
http://mbeddr.com
Projectional editing How does MPS work?
“variable declaration”
expression
Embedding Expressions Language
into Page Margins Language
Pages Margins DSL with embedded expressions language
”variable declaration”
expression
enabling expressions into already defined Page Margins DSL
Embedding languages
embedding not in the sense “embedded DSL”
“internal DSL”
Scala
XML
Lang A
Lang B
neither A nor B change
should work even with conflicting syntaxes
non-invasive embedding
KernelF “expressions language”
Markus Voelter
Overview of KernelF
primitive types
arithmetical and comparison operations
higher-order functions
number
option types
attempt types
null values
exception handling
static types
user-defined types tuples
functional type inference
Boolean string
enum record
+ - * / == != > < >= <=
no generics
no algebraic types
built-in collections are generic
not designed for building abstractions abstractions – in host DSL
keyword-rich
many first-class constructs
enum with data all immutable
natural notation for mathematical expressions
Excel-style spreadsheet
within code
Number types
int float
too much focused on need of programmers
business domain doesn’t find them useful
no usual types
numbers with range and precision
number[10|20]{2}
number[0|inf]
number[-inf|inf]{0}
positive integer
integer, unlimited range
decimal with 2 decimal places, value between 10 and 20
number{2}
number[2.2|3.8] range as specified, precision derived
decimal with 2 decimal places, unlimited range
Type tags
additional information attached to a typetag checked by type system
display(airportCode : string)
require only capitalized strings
display(airportCode : string<capitalized>)
<!tag>unary tags doesn’t have the taghas the tag unspecified
n-ary tags set of ordered values easy normal hard
val simpleText : string<easy> = “I go to school.”
val normalText : string<normal> = “This is an abstract painting.”
val complexText : string<hard> = “We semi-classically quantize circular strings.”
<tag>
fun sendToProfessor(text: string<hard->)
fun publishInTwitter(text: string<easy+>)
fun printOnTShirt(text: string<normal>)
hard, normal, easy
easy, normal, hard
toAllUpper(s : string) : string<capitalized>
Option types
handle null values in a typesafe way
val x : option<number> =
if something
then 1
else none
a term in an expression evaluates to none the whole expression is none⇒	
test whether an option does contain a value isSome(x)
Attempt types error handling
type system support for error handling
base type
attempt type
error literals
attempt< baseType | err1, err2, ..., errN >
fun getWeather(city: string): attempt<number[-40|40] | timeout, notFound> =
if ... then getTemp
else if ... then error(timeout)
else error(notFound)
val displayDegrees : string =
try getWeather(“Helsinki”) => val + “ degrees”
error<timeout> => “Timeout”
error<notFound> => “Not found”
“payload”
to be handled by calling code
via metaprogramming
“Flexible” language
adding new first-class constructs
removing constructs
exchangeable primitive types
overriding syntax
new syntax for existing language constructs
replace primitive types with types from the domain
LISP extensibleRacket parser-based
extend the language, but not the IDE
syntactic style difficult for non-programmers only textual languages
language workbench
Natural language function calls
@syntax{ accelerate to @[to] with @[at] }
car.accelerate to 10 with 2
car.accelerate(10, 2)
ext fun accelerate (this: Car, to: int, at: int) = ...
also appears in autocomplete menu
positional arguments less easily perceived by business users
Stateful language effect tracking
expressions don’t have side effects
results of function calls can be cached
KernelF can be extended to support expressions with side effects
which functions can be cached?
effects read write idempotence
Stateful language boxes
immutable data can’t change a value after it’s been created
invent new name for new value
boxes do not require mutable version of all immutable data structures
immutable
its contents can change
box
val counter: box<int> = box(0)
fun increase() {
counter.update(counter.val + 1)
}
read effectmodify effect
counter.update(it + 1)
current content of the box
val a = list(1, 2, 3)
val b = a.plus(4)

Weitere ähnliche Inhalte

Was ist angesagt?

C++ programming program design including data structures
C++ programming program design including data structures C++ programming program design including data structures
C++ programming program design including data structures Ahmad Idrees
 
C++ PROGRAMMING BASICS
C++ PROGRAMMING BASICSC++ PROGRAMMING BASICS
C++ PROGRAMMING BASICSAami Kakakhel
 
C Programming Training In Ambala ! BATRA COMPUTER CENTRE
C Programming Training In Ambala ! BATRA COMPUTER CENTREC Programming Training In Ambala ! BATRA COMPUTER CENTRE
C Programming Training In Ambala ! BATRA COMPUTER CENTREjatin batra
 
Denis Lebedev. Non functional swift.
Denis Lebedev. Non functional swift.Denis Lebedev. Non functional swift.
Denis Lebedev. Non functional swift.Alina Dolgikh
 
Computer Organization - Programming the basic computer : Machine Language, As...
Computer Organization - Programming the basic computer : Machine Language, As...Computer Organization - Programming the basic computer : Machine Language, As...
Computer Organization - Programming the basic computer : Machine Language, As...Maitri Thakkar
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming LanguageAhmad Idrees
 
C language industrial training report
C language industrial training reportC language industrial training report
C language industrial training reportRaushan Pandey
 

Was ist angesagt? (10)

C++ programming program design including data structures
C++ programming program design including data structures C++ programming program design including data structures
C++ programming program design including data structures
 
C++ PROGRAMMING BASICS
C++ PROGRAMMING BASICSC++ PROGRAMMING BASICS
C++ PROGRAMMING BASICS
 
21csharp
21csharp21csharp
21csharp
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 
Chap 01[1]
Chap 01[1]Chap 01[1]
Chap 01[1]
 
C Programming Training In Ambala ! BATRA COMPUTER CENTRE
C Programming Training In Ambala ! BATRA COMPUTER CENTREC Programming Training In Ambala ! BATRA COMPUTER CENTRE
C Programming Training In Ambala ! BATRA COMPUTER CENTRE
 
Denis Lebedev. Non functional swift.
Denis Lebedev. Non functional swift.Denis Lebedev. Non functional swift.
Denis Lebedev. Non functional swift.
 
Computer Organization - Programming the basic computer : Machine Language, As...
Computer Organization - Programming the basic computer : Machine Language, As...Computer Organization - Programming the basic computer : Machine Language, As...
Computer Organization - Programming the basic computer : Machine Language, As...
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 
C language industrial training report
C language industrial training reportC language industrial training report
C language industrial training report
 

Ähnlich wie KernelF: a functional core for domain-specific languages in JetBrains MPS

Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)lennartkats
 
Scripting in InduSoft Web Studio
Scripting in InduSoft Web StudioScripting in InduSoft Web Studio
Scripting in InduSoft Web StudioAVEVA
 
Unit 1 c - all topics
Unit 1   c - all topicsUnit 1   c - all topics
Unit 1 c - all topicsveningstonk
 
Software Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & SpoofaxSoftware Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & SpoofaxEelco Visser
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compilerIffat Anjum
 
Practical basics on c++
Practical basics on c++Practical basics on c++
Practical basics on c++Marco Izzotti
 
Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Vitaly Baum
 
The Ring programming language version 1.10 book - Part 7 of 212
The Ring programming language version 1.10 book - Part 7 of 212The Ring programming language version 1.10 book - Part 7 of 212
The Ring programming language version 1.10 book - Part 7 of 212Mahmoud Samir Fayed
 
Architecting Domain-Specific Languages
Architecting Domain-Specific LanguagesArchitecting Domain-Specific Languages
Architecting Domain-Specific LanguagesMarkus Voelter
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...Sang Don Kim
 
Computer architecture is made up of two main components the Instruct.docx
Computer architecture is made up of two main components the Instruct.docxComputer architecture is made up of two main components the Instruct.docx
Computer architecture is made up of two main components the Instruct.docxbrownliecarmella
 

Ähnlich wie KernelF: a functional core for domain-specific languages in JetBrains MPS (20)

Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)Remix Your Language Tooling (JSConf.eu 2012)
Remix Your Language Tooling (JSConf.eu 2012)
 
gayathri.p.pptx
gayathri.p.pptxgayathri.p.pptx
gayathri.p.pptx
 
Scripting in InduSoft Web Studio
Scripting in InduSoft Web StudioScripting in InduSoft Web Studio
Scripting in InduSoft Web Studio
 
Unit 1 c - all topics
Unit 1   c - all topicsUnit 1   c - all topics
Unit 1 c - all topics
 
Software Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & SpoofaxSoftware Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & Spoofax
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Unit1 C
Unit1 CUnit1 C
Unit1 C
 
C programming part2
C programming part2C programming part2
C programming part2
 
C programming part2
C programming part2C programming part2
C programming part2
 
C programming part2
C programming part2C programming part2
C programming part2
 
Practical basics on c++
Practical basics on c++Practical basics on c++
Practical basics on c++
 
Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)
 
The Ring programming language version 1.10 book - Part 7 of 212
The Ring programming language version 1.10 book - Part 7 of 212The Ring programming language version 1.10 book - Part 7 of 212
The Ring programming language version 1.10 book - Part 7 of 212
 
Architecting Domain-Specific Languages
Architecting Domain-Specific LanguagesArchitecting Domain-Specific Languages
Architecting Domain-Specific Languages
 
Compilers Design
Compilers DesignCompilers Design
Compilers Design
 
Unit 1 cd
Unit 1 cdUnit 1 cd
Unit 1 cd
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
 
Lecture 01 2017
Lecture 01 2017Lecture 01 2017
Lecture 01 2017
 
Computer architecture is made up of two main components the Instruct.docx
Computer architecture is made up of two main components the Instruct.docxComputer architecture is made up of two main components the Instruct.docx
Computer architecture is made up of two main components the Instruct.docx
 

Mehr von Mikhail Barash

MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen
MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen
MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen Mikhail Barash
 
MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...
MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...
MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...Mikhail Barash
 
MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...
MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...
MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...Mikhail Barash
 
MODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept Entity
MODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept EntityMODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept Entity
MODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept EntityMikhail Barash
 
Towards a mnemonic classification of software languages
Towards a mnemonic classification of software languagesTowards a mnemonic classification of software languages
Towards a mnemonic classification of software languagesMikhail Barash
 
Worst practices for domain-specific modelling
Worst practices for domain-specific modellingWorst practices for domain-specific modelling
Worst practices for domain-specific modellingMikhail Barash
 
An ABC of JetBrains MPS
An ABC of JetBrains MPSAn ABC of JetBrains MPS
An ABC of JetBrains MPSMikhail Barash
 
Reflections on teaching JetBrains MPS within a university course
Reflections on teaching JetBrains MPS within a university courseReflections on teaching JetBrains MPS within a university course
Reflections on teaching JetBrains MPS within a university courseMikhail Barash
 
Language Workbench Language Wheel
Language Workbench Language WheelLanguage Workbench Language Wheel
Language Workbench Language WheelMikhail Barash
 
Design concerns for concrete syntax
Design concerns for concrete syntaxDesign concerns for concrete syntax
Design concerns for concrete syntaxMikhail Barash
 
Design dimensions of DSLs
Design dimensions of DSLsDesign dimensions of DSLs
Design dimensions of DSLsMikhail Barash
 
JetBrains MPS: Typesystem Aspect
JetBrains MPS: Typesystem AspectJetBrains MPS: Typesystem Aspect
JetBrains MPS: Typesystem AspectMikhail Barash
 
JetBrains MPS: Editor Aspect
JetBrains MPS: Editor AspectJetBrains MPS: Editor Aspect
JetBrains MPS: Editor AspectMikhail Barash
 
JetBrains MPS: Structure Aspect
JetBrains MPS: Structure AspectJetBrains MPS: Structure Aspect
JetBrains MPS: Structure AspectMikhail Barash
 
Xtext: type checking and scoping
Xtext: type checking and scopingXtext: type checking and scoping
Xtext: type checking and scopingMikhail Barash
 
Xtext: code generation
Xtext: code generationXtext: code generation
Xtext: code generationMikhail Barash
 
Xtext: validation, quickfixes, custom formatting
Xtext: validation, quickfixes, custom formattingXtext: validation, quickfixes, custom formatting
Xtext: validation, quickfixes, custom formattingMikhail Barash
 
Xtend Programming Language
Xtend Programming LanguageXtend Programming Language
Xtend Programming LanguageMikhail Barash
 

Mehr von Mikhail Barash (20)

MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen
MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen
MODELS 2020 Tutorial on MPS - Supplementary Material 8 - TextGen
 
MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...
MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...
MODELS 2020 Tutorial on MPS - Supplementary Material 5 - Creating concept Ent...
 
MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...
MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...
MODELS 2020 Tutorial on MPS - Supplementary Material 3 - Creating editors for...
 
MODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept Entity
MODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept EntityMODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept Entity
MODELS 2020 Tutorial on MPS - Supplementary Material 1 - Creating concept Entity
 
Towards a mnemonic classification of software languages
Towards a mnemonic classification of software languagesTowards a mnemonic classification of software languages
Towards a mnemonic classification of software languages
 
Worst practices for domain-specific modelling
Worst practices for domain-specific modellingWorst practices for domain-specific modelling
Worst practices for domain-specific modelling
 
An ABC of JetBrains MPS
An ABC of JetBrains MPSAn ABC of JetBrains MPS
An ABC of JetBrains MPS
 
Reflections on teaching JetBrains MPS within a university course
Reflections on teaching JetBrains MPS within a university courseReflections on teaching JetBrains MPS within a university course
Reflections on teaching JetBrains MPS within a university course
 
Language Workbench Language Wheel
Language Workbench Language WheelLanguage Workbench Language Wheel
Language Workbench Language Wheel
 
DSL development
DSL developmentDSL development
DSL development
 
Design concerns for concrete syntax
Design concerns for concrete syntaxDesign concerns for concrete syntax
Design concerns for concrete syntax
 
Design dimensions of DSLs
Design dimensions of DSLsDesign dimensions of DSLs
Design dimensions of DSLs
 
JetBrains MPS: Typesystem Aspect
JetBrains MPS: Typesystem AspectJetBrains MPS: Typesystem Aspect
JetBrains MPS: Typesystem Aspect
 
JetBrains MPS: Editor Aspect
JetBrains MPS: Editor AspectJetBrains MPS: Editor Aspect
JetBrains MPS: Editor Aspect
 
JetBrains MPS: Structure Aspect
JetBrains MPS: Structure AspectJetBrains MPS: Structure Aspect
JetBrains MPS: Structure Aspect
 
Projectional editing
Projectional editingProjectional editing
Projectional editing
 
Xtext: type checking and scoping
Xtext: type checking and scopingXtext: type checking and scoping
Xtext: type checking and scoping
 
Xtext: code generation
Xtext: code generationXtext: code generation
Xtext: code generation
 
Xtext: validation, quickfixes, custom formatting
Xtext: validation, quickfixes, custom formattingXtext: validation, quickfixes, custom formatting
Xtext: validation, quickfixes, custom formatting
 
Xtend Programming Language
Xtend Programming LanguageXtend Programming Language
Xtend Programming Language
 

Kürzlich hochgeladen

Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 

Kürzlich hochgeladen (20)

Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

KernelF: a functional core for domain-specific languages in JetBrains MPS

  • 1. KernelF Turku Centre for Computer Science Mikhail Barash Åbo Akademi Finland a functional core @mikhail_barash for DSLs
  • 3.
  • 4.
  • 5.
  • 7. John, CEO publishing company left right top bottom 1 page enumeration margins single page range open interval 20..30 40- measurement units mm cm inches
  • 8.
  • 9.
  • 10. 1999
  • 11.
  • 12. Hi, We've just got new order, diary No: 1999/3456/32-A. It's books, covers 250g/m2. Left: 30 mm Top: 15 mm Right: 20 mm Bottom: 1 in Thanks, secretary typesetter some structure
  • 13. 2000
  • 14.
  • 17. 2001
  • 18.
  • 19. start marker end marker row: start.row + 1 col: start.col + 6 row: start.row + 4 col: start.col + 8 error messages typesetter
  • 20. 2002
  • 22. 2003
  • 24.
  • 25. 2007
  • 26.
  • 29. 2010s
  • 30. Language workbenches requires parsingtextual DSL automates definition of languageslanguage workbench implementing IDE is tedious vital for adoption and success of languageIDE automates creation of IDEs for languages
  • 31. IDEA-level custom IDE rich notation custom auto complete intentions (quick fixes) domain-specific error messages
  • 32. key representation of program abstract syntax tree (AST) can be projected into different representations text diagrams tables forms textual form of code only meant for the programmer but it is unambiguous can look ambiguous no parsing needed http://mbeddr.com Projectional editing How does MPS work?
  • 34. Embedding Expressions Language into Page Margins Language
  • 35. Pages Margins DSL with embedded expressions language ”variable declaration” expression enabling expressions into already defined Page Margins DSL
  • 36. Embedding languages embedding not in the sense “embedded DSL” “internal DSL” Scala XML Lang A Lang B neither A nor B change should work even with conflicting syntaxes non-invasive embedding
  • 38. Overview of KernelF primitive types arithmetical and comparison operations higher-order functions number option types attempt types null values exception handling static types user-defined types tuples functional type inference Boolean string enum record + - * / == != > < >= <= no generics no algebraic types built-in collections are generic not designed for building abstractions abstractions – in host DSL keyword-rich many first-class constructs enum with data all immutable
  • 39. natural notation for mathematical expressions Excel-style spreadsheet within code
  • 40. Number types int float too much focused on need of programmers business domain doesn’t find them useful no usual types numbers with range and precision number[10|20]{2} number[0|inf] number[-inf|inf]{0} positive integer integer, unlimited range decimal with 2 decimal places, value between 10 and 20 number{2} number[2.2|3.8] range as specified, precision derived decimal with 2 decimal places, unlimited range
  • 41. Type tags additional information attached to a typetag checked by type system display(airportCode : string) require only capitalized strings display(airportCode : string<capitalized>) <!tag>unary tags doesn’t have the taghas the tag unspecified n-ary tags set of ordered values easy normal hard val simpleText : string<easy> = “I go to school.” val normalText : string<normal> = “This is an abstract painting.” val complexText : string<hard> = “We semi-classically quantize circular strings.” <tag> fun sendToProfessor(text: string<hard->) fun publishInTwitter(text: string<easy+>) fun printOnTShirt(text: string<normal>) hard, normal, easy easy, normal, hard toAllUpper(s : string) : string<capitalized>
  • 42. Option types handle null values in a typesafe way val x : option<number> = if something then 1 else none a term in an expression evaluates to none the whole expression is none⇒ test whether an option does contain a value isSome(x)
  • 43. Attempt types error handling type system support for error handling base type attempt type error literals attempt< baseType | err1, err2, ..., errN > fun getWeather(city: string): attempt<number[-40|40] | timeout, notFound> = if ... then getTemp else if ... then error(timeout) else error(notFound) val displayDegrees : string = try getWeather(“Helsinki”) => val + “ degrees” error<timeout> => “Timeout” error<notFound> => “Not found” “payload” to be handled by calling code
  • 44. via metaprogramming “Flexible” language adding new first-class constructs removing constructs exchangeable primitive types overriding syntax new syntax for existing language constructs replace primitive types with types from the domain LISP extensibleRacket parser-based extend the language, but not the IDE syntactic style difficult for non-programmers only textual languages language workbench
  • 45. Natural language function calls @syntax{ accelerate to @[to] with @[at] } car.accelerate to 10 with 2 car.accelerate(10, 2) ext fun accelerate (this: Car, to: int, at: int) = ... also appears in autocomplete menu positional arguments less easily perceived by business users
  • 46. Stateful language effect tracking expressions don’t have side effects results of function calls can be cached KernelF can be extended to support expressions with side effects which functions can be cached? effects read write idempotence
  • 47. Stateful language boxes immutable data can’t change a value after it’s been created invent new name for new value boxes do not require mutable version of all immutable data structures immutable its contents can change box val counter: box<int> = box(0) fun increase() { counter.update(counter.val + 1) } read effectmodify effect counter.update(it + 1) current content of the box val a = list(1, 2, 3) val b = a.plus(4)