SlideShare ist ein Scribd-Unternehmen logo
1 von 8
Downloaden Sie, um offline zu lesen
External DSLs
External DSL: simplest example
entity A {
number n
text t
t = “Hello World”
n = 5
print t
print n
}
entity B extends A {
number m
m = n
print m
}
language of entities
entity similar to Java class
field
can extend another entity
assignment statement
print statement
inheritance of fields
no expressions
can be integer, string, Boolean
to simplify development
scopes of visibility
data types
Crash course on compilers
entity A {
number amount
text hi
hi = “Hello World”
amount = 500
print hi
print n
}
entity B extends A {
number m
m = amount
print m
}
source code
find lexemes
figure out constructions
check context conditions
map constructions to new code
amount ident{ openparen 500 number
IntFieldDecl = “number” ident
precise name of a field doesn’t matter
all variables declared
IntFieldDecl(ident)  “int” ident
no duplicate variables types match in assignments
lexical analysis
syntax analysis
semantic analysis
code generation optimization
x:=0; x:=1; becomes x:=1;
internal
representation
symbol table scoping rules
scope – set of allowed
targets for a reference
Crash course on compilers
function foo($a) {
// ...
}
source code in PHP
abstract syntax tree (AST)
Internal representation
program model
much more useful representation of program
can be manipulated by walking the tree
Semantic model
entity A {
number amount
text hi
hi = “Hello World”
amount = 500
print hi
print n
}
entity B extends A {
number m
m = amount
print m
}
semantic model
represents the same subject that DSL describes
Example
separation of concerns between language and semantics
object model can take other forms as well
A: amount like 0, hi like ’a’
hi is ‘Hello world’
amount is 500
@hi @amount
(A)B: m like 0
m is amount
@m
possible other
syntax for this DSL
metamodel
Semantic model vs. AST
semantic model
HelloWorld {
Component content = VerticalLayout {
Component myLabel = Label {
String Label caption = “Hello world!”;
}
Component myButton = Button {
String Button caption = “Push Me!”;
Function changeCaption = () {
caption = “Pushed!”;
} listens to click;
}
}
}
TouchScript (H. Westergård, 2013)
abstract syntax tree
Parser generators
automatically generate parser from grammar description
entity A {
number amount
text hi
hi = “Hello World”
amount = 500
print hi
print n
}
entity B extends A {
number m
m = amount
print m
}
Entity 
‘entity’ ident [‘extends’ ident] ‘{‘
{FieldDeclaration}
{Statement}
‘}’
FieldDeclaration  (‘number’ | ‘text’) ident
Statement  Assignment | Print
Assignment  ident ‘=‘ Expression
Expression  integer_value | ident
Print  ‘print’ Expression
grammar
[ ] – for optional parts
{ } – for parts that can
repeat any number of times
( ) – for grouping
| – for alternatives
lex/yacc CoCo/R ANTLR
Writing a grammar Ohm editor
https://ohmlang.github.io/editor/
http://tinlizzie.org/~awarth/live2016/
abstract syntax tree

Weitere ähnliche Inhalte

Was ist angesagt?

JetBrains MPS: Editor Aspect
JetBrains MPS: Editor AspectJetBrains MPS: Editor Aspect
JetBrains MPS: Editor AspectMikhail Barash
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii pptJStalinAsstProfessor
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#Dr.Neeraj Kumar Pandey
 
Literals,variables,datatype in C#
Literals,variables,datatype in C#Literals,variables,datatype in C#
Literals,variables,datatype in C#Prasanna Kumar SM
 
C# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data TypesC# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data TypesMicheal Ogundero
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C ProgrammingPreeti Kashyap
 
Computer programming and utilization 2110003
Computer programming and utilization 2110003Computer programming and utilization 2110003
Computer programming and utilization 2110003Juhi Shah
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2MOHIT TOMAR
 
Programming in python - Week 2
Programming in python - Week 2Programming in python - Week 2
Programming in python - Week 2Priya Nayak
 

Was ist angesagt? (20)

JetBrains MPS: Editor Aspect
JetBrains MPS: Editor AspectJetBrains MPS: Editor Aspect
JetBrains MPS: Editor Aspect
 
Tokens in C++
Tokens in C++Tokens in C++
Tokens in C++
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii ppt
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
 
C tokens
C tokensC tokens
C tokens
 
Literals,variables,datatype in C#
Literals,variables,datatype in C#Literals,variables,datatype in C#
Literals,variables,datatype in C#
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
code analysis for c++
code analysis for c++code analysis for c++
code analysis for c++
 
OOP Poster Presentation
OOP Poster PresentationOOP Poster Presentation
OOP Poster Presentation
 
C# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data TypesC# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data Types
 
Code quality
Code qualityCode quality
Code quality
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
INTRODUCTION TO C
INTRODUCTION TO CINTRODUCTION TO C
INTRODUCTION TO C
 
Word processing
Word processingWord processing
Word processing
 
Computer programming and utilization 2110003
Computer programming and utilization 2110003Computer programming and utilization 2110003
Computer programming and utilization 2110003
 
Methods in C#
Methods in C#Methods in C#
Methods in C#
 
Data types in C
Data types in CData types in C
Data types in C
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2
 
Overview of c#
Overview of c#Overview of c#
Overview of c#
 
Programming in python - Week 2
Programming in python - Week 2Programming in python - Week 2
Programming in python - Week 2
 

Ähnlich wie External domain-specific languages

A "M"ind Bending Experience. Power Query for Power BI and Beyond.
A "M"ind Bending Experience. Power Query for Power BI and Beyond.A "M"ind Bending Experience. Power Query for Power BI and Beyond.
A "M"ind Bending Experience. Power Query for Power BI and Beyond.Alex Powers
 
A "M"ind Bending Experience. Power Query for Excel and Beyond.
A "M"ind Bending Experience. Power Query for Excel and Beyond.A "M"ind Bending Experience. Power Query for Excel and Beyond.
A "M"ind Bending Experience. Power Query for Excel and Beyond.Alex Powers
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| FundamentalsMohd Sajjad
 
Accessing loosely structured data from F# and C#
Accessing loosely structured data from F# and C#Accessing loosely structured data from F# and C#
Accessing loosely structured data from F# and C#Tomas Petricek
 
PHP in one presentation
PHP in one presentationPHP in one presentation
PHP in one presentationMilad Rahimi
 
Functional programming with FSharp
Functional programming with FSharpFunctional programming with FSharp
Functional programming with FSharpDaniele Pozzobon
 
Typescript - why it's awesome
Typescript - why it's awesomeTypescript - why it's awesome
Typescript - why it's awesomePiotr Miazga
 
C data types, arrays and structs
C data types, arrays and structsC data types, arrays and structs
C data types, arrays and structsSaad Sheikh
 
C presentation book
C presentation bookC presentation book
C presentation bookkrunal1210
 
Tricks in natural language processing
Tricks in natural language processingTricks in natural language processing
Tricks in natural language processingBabu Priyavrat
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory buildingClarkTony
 
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdf
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdfconceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdf
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdfSahajShrimal1
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxKrishanPalSingh39
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2mohamedsamyali
 
IntroToCSharpcode.ppt
IntroToCSharpcode.pptIntroToCSharpcode.ppt
IntroToCSharpcode.pptpsundarau
 

Ähnlich wie External domain-specific languages (20)

A "M"ind Bending Experience. Power Query for Power BI and Beyond.
A "M"ind Bending Experience. Power Query for Power BI and Beyond.A "M"ind Bending Experience. Power Query for Power BI and Beyond.
A "M"ind Bending Experience. Power Query for Power BI and Beyond.
 
A "M"ind Bending Experience. Power Query for Excel and Beyond.
A "M"ind Bending Experience. Power Query for Excel and Beyond.A "M"ind Bending Experience. Power Query for Excel and Beyond.
A "M"ind Bending Experience. Power Query for Excel and Beyond.
 
Data types
Data typesData types
Data types
 
WEB DEVELOPMENT
WEB DEVELOPMENTWEB DEVELOPMENT
WEB DEVELOPMENT
 
Python-01| Fundamentals
Python-01| FundamentalsPython-01| Fundamentals
Python-01| Fundamentals
 
Accessing loosely structured data from F# and C#
Accessing loosely structured data from F# and C#Accessing loosely structured data from F# and C#
Accessing loosely structured data from F# and C#
 
PHP in one presentation
PHP in one presentationPHP in one presentation
PHP in one presentation
 
Functional programming with FSharp
Functional programming with FSharpFunctional programming with FSharp
Functional programming with FSharp
 
Typescript - why it's awesome
Typescript - why it's awesomeTypescript - why it's awesome
Typescript - why it's awesome
 
C data types, arrays and structs
C data types, arrays and structsC data types, arrays and structs
C data types, arrays and structs
 
C presentation book
C presentation bookC presentation book
C presentation book
 
Tricks in natural language processing
Tricks in natural language processingTricks in natural language processing
Tricks in natural language processing
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory building
 
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdf
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdfconceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdf
conceptsinobjectorientedprogramminglanguages-12659959597745-phpapp02.pdf
 
presentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptxpresentation_data_types_and_operators_1513499834_241350.pptx
presentation_data_types_and_operators_1513499834_241350.pptx
 
C# Summer course - Lecture 2
C# Summer course - Lecture 2C# Summer course - Lecture 2
C# Summer course - Lecture 2
 
IntroToCSharpcode.ppt
IntroToCSharpcode.pptIntroToCSharpcode.ppt
IntroToCSharpcode.ppt
 
LEARN C#
LEARN C#LEARN C#
LEARN C#
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 
Php
PhpPhp
Php
 

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
 
KernelF: a functional core for domain-specific languages in JetBrains MPS
KernelF: a functional core for domain-specific languages in JetBrains MPSKernelF: a functional core for domain-specific languages in JetBrains MPS
KernelF: a functional core for domain-specific languages in 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
 
Xtext: type checking and scoping
Xtext: type checking and scopingXtext: type checking and scoping
Xtext: type checking and scopingMikhail 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
 
Implementing DSLs in practice
Implementing DSLs in practiceImplementing DSLs in practice
Implementing DSLs in practiceMikhail Barash
 
Internal domain-specific languages
Internal domain-specific languagesInternal domain-specific languages
Internal domain-specific languagesMikhail Barash
 
Zoo of domain-specific languages
Zoo of domain-specific languagesZoo of domain-specific languages
Zoo of domain-specific languagesMikhail Barash
 

Mehr von Mikhail Barash (19)

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
 
KernelF: a functional core for domain-specific languages in JetBrains MPS
KernelF: a functional core for domain-specific languages in JetBrains MPSKernelF: a functional core for domain-specific languages in JetBrains MPS
KernelF: a functional core for domain-specific languages in 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
 
Xtext: type checking and scoping
Xtext: type checking and scopingXtext: type checking and scoping
Xtext: type checking and scoping
 
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
 
Language Workbenches
Language WorkbenchesLanguage Workbenches
Language Workbenches
 
Implementing DSLs in practice
Implementing DSLs in practiceImplementing DSLs in practice
Implementing DSLs in practice
 
Internal domain-specific languages
Internal domain-specific languagesInternal domain-specific languages
Internal domain-specific languages
 
DSLs: what, why, how
DSLs: what, why, howDSLs: what, why, how
DSLs: what, why, how
 
Zoo of domain-specific languages
Zoo of domain-specific languagesZoo of domain-specific languages
Zoo of domain-specific languages
 

Kürzlich hochgeladen

Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 

Kürzlich hochgeladen (20)

Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 

External domain-specific languages

  • 2. External DSL: simplest example entity A { number n text t t = “Hello World” n = 5 print t print n } entity B extends A { number m m = n print m } language of entities entity similar to Java class field can extend another entity assignment statement print statement inheritance of fields no expressions can be integer, string, Boolean to simplify development scopes of visibility data types
  • 3. Crash course on compilers entity A { number amount text hi hi = “Hello World” amount = 500 print hi print n } entity B extends A { number m m = amount print m } source code find lexemes figure out constructions check context conditions map constructions to new code amount ident{ openparen 500 number IntFieldDecl = “number” ident precise name of a field doesn’t matter all variables declared IntFieldDecl(ident)  “int” ident no duplicate variables types match in assignments lexical analysis syntax analysis semantic analysis code generation optimization x:=0; x:=1; becomes x:=1; internal representation symbol table scoping rules scope – set of allowed targets for a reference
  • 4. Crash course on compilers function foo($a) { // ... } source code in PHP abstract syntax tree (AST) Internal representation program model much more useful representation of program can be manipulated by walking the tree
  • 5. Semantic model entity A { number amount text hi hi = “Hello World” amount = 500 print hi print n } entity B extends A { number m m = amount print m } semantic model represents the same subject that DSL describes Example separation of concerns between language and semantics object model can take other forms as well A: amount like 0, hi like ’a’ hi is ‘Hello world’ amount is 500 @hi @amount (A)B: m like 0 m is amount @m possible other syntax for this DSL metamodel
  • 6. Semantic model vs. AST semantic model HelloWorld { Component content = VerticalLayout { Component myLabel = Label { String Label caption = “Hello world!”; } Component myButton = Button { String Button caption = “Push Me!”; Function changeCaption = () { caption = “Pushed!”; } listens to click; } } } TouchScript (H. Westergård, 2013) abstract syntax tree
  • 7. Parser generators automatically generate parser from grammar description entity A { number amount text hi hi = “Hello World” amount = 500 print hi print n } entity B extends A { number m m = amount print m } Entity  ‘entity’ ident [‘extends’ ident] ‘{‘ {FieldDeclaration} {Statement} ‘}’ FieldDeclaration  (‘number’ | ‘text’) ident Statement  Assignment | Print Assignment  ident ‘=‘ Expression Expression  integer_value | ident Print  ‘print’ Expression grammar [ ] – for optional parts { } – for parts that can repeat any number of times ( ) – for grouping | – for alternatives lex/yacc CoCo/R ANTLR
  • 8. Writing a grammar Ohm editor https://ohmlang.github.io/editor/ http://tinlizzie.org/~awarth/live2016/ abstract syntax tree