SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
The Spoofax
Language Workbench
Eelco Visser
Lennart Kats
Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
Spoofax
hands-on material:
www.strategoxt.org/Spoofax/Devnology
Domain-Specific
Languages (DSLs)
Domain:
• Mobile phone
• Web
• Financial
• Printer design
• ...
Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
Can offer:
• Specialized syntax
• Specialized analysis
• Specialized
optimizations
• Platform independence
Example DSL:
Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
Syntax definition
★ concrete + abstract syntax
Static semantics
★ error checking
★ name resolution
★ type analysis
Model-to-model transformation
★ express constructs in core language
Code generation
★ translate core language models to implementation
Problem: building DSLs
parser
generators
meta-
programming
languages
meta-
programming
libraries
template
engines
Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
Problem: building DSLs (ct’d)
Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
Editor Services
syntactic editor services
• syntax highlighting
• syntax checking
• outline view
• bracket matching, insertion
• automatic indentation
• syntax completion
• ...
semantic editor services
• error marking
• reference resolving
• hover help
• mark occurrences
• content completion
• refactoring
• ...
Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
Syntax definition
Static semantics
Model-to-model transformation
Code generation
Syntactic Editor Services
Semantic Editor Services
}Spoofax
how can we make these things cheaply?
Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
• <spoofax screenshot: lang def and lang use
in Eclipse workspace>
Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
#1 Syntax definition
• Basic expression language
1+2+3
Expr “+” Expr -> Expr {cons(“Plus”)}
Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
#1 Syntax definition
• Basic expression language
1+2+3
2
1
3
+
+
21
3
+
+
is that or ?
what does the abstract syntax view say?
#1 Syntax definition
• Basic expression language
1+2*3
2
1
3
+
*
21
3
*is that or ?
what does the abstract syntax view say?
+
The Spoofax Solution:
Declarative Syntax with SDF
Declarative, explicit disambigation rules
Clean abstract syntax
Composable syntax definitions
#2 Transformation
Tip. Some other operators:
subtS, mulS, divS, gt, lt, eq
Transform 1+2 to <addition of> 1 and 2:
calc:
Add(Int(i), Int(j)) -> Int(<addS> (i, j))
#2 Transformation
Transform 1+2 to <addition of> 1 and 2:
calc:
Add(Int(i), Int(j)) -> Int(<addS> (i, j))
calculate = bottomup(try(calc))
Tip. Some other operators:
subtS, mulS, divS, gt, lt, eq
#3 Equations
New syntax
New semantics
x = 2
y = 3
result = 90 * x + 30 * y
#3 Equations
x = 2
y = 3
result = 90 * x + 30 * y
Assign(“x”, INT(2))
calc: Assign(x, e) -> e
where rules(GetValue: x -> e)
calc: Var(x) -> <GetValue> x
New syntax
New semantics
x = 2
y = 3
result = 90 * x + 30 * z
#4 Error markers
(Var(“z”), “Variable z is not defined”)
transform
#4 Error markers
analyze = topdown(try(record-var))
record-var:
Assign(x, e) -> Assign(x, e)
with
rules(
GetVar :+ x -> e
)
constraint-errors = collect-all(constraint-error, conc)
constraint-error:
Var(x) -> (x, $[Variable [x] is not defined])
where
not(<GetVar> x)
#4 Error markers
#5 Refinement
analyze = topdown(try(record-var))
record-var:
Assign(x, e) -> Assign(x, e)
with
rules(
GetVar :+ x -> e
)
constraint-errors = collect-all(constraint-error, conc)
constraint-error:
Var(x) -> (x, $[Variable [x] is not defined])
where
not(<GetVar> x)
#4 Error markers
#5 Refinement
editor-resolve:
(Var(x), position, ast, path, project-path) -> target
where
target := <GetVar> x
editor-complete:
(Var(x), position, ast, path, project-path) -> proposals
where
proposals := <all-keys-GetVar> x
Refinement &
Free play
Syntax definition
Static semantics
Model-to-model transformation
Code generation
Syntactic Editor Services
Semantic Editor Services
}Spoofax
www.spoofax.org

Weitere ähnliche Inhalte

Was ist angesagt?

T3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerT3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerDavid Muñoz Díaz
 
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.Ruslan Shevchenko
 
scala-gopher: async implementation of CSP for scala
scala-gopher:  async implementation of CSP  for  scalascala-gopher:  async implementation of CSP  for  scala
scala-gopher: async implementation of CSP for scalaRuslan Shevchenko
 
Code quailty metrics demystified
Code quailty metrics demystifiedCode quailty metrics demystified
Code quailty metrics demystifiedJeroen Resoort
 
The best language in the world
The best language in the worldThe best language in the world
The best language in the worldDavid Muñoz Díaz
 
GUL UC3M - Introduction to functional programming
GUL UC3M - Introduction to functional programmingGUL UC3M - Introduction to functional programming
GUL UC3M - Introduction to functional programmingDavid Muñoz Díaz
 

Was ist angesagt? (8)

T3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmerT3chFest 2016 - The polyglot programmer
T3chFest 2016 - The polyglot programmer
 
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
Scala-Gopher: CSP-style programming techniques with idiomatic Scala.
 
scala-gopher: async implementation of CSP for scala
scala-gopher:  async implementation of CSP  for  scalascala-gopher:  async implementation of CSP  for  scala
scala-gopher: async implementation of CSP for scala
 
Code quailty metrics demystified
Code quailty metrics demystifiedCode quailty metrics demystified
Code quailty metrics demystified
 
The best language in the world
The best language in the worldThe best language in the world
The best language in the world
 
GUL UC3M - Introduction to functional programming
GUL UC3M - Introduction to functional programmingGUL UC3M - Introduction to functional programming
GUL UC3M - Introduction to functional programming
 
201801 CSE240 Lecture 14
201801 CSE240 Lecture 14201801 CSE240 Lecture 14
201801 CSE240 Lecture 14
 
Csp scala wixmeetup2016
Csp scala wixmeetup2016Csp scala wixmeetup2016
Csp scala wixmeetup2016
 

Andere mochten auch

anheuser-busch 2006AR_LetterToShareholders
anheuser-busch 2006AR_LetterToShareholdersanheuser-busch 2006AR_LetterToShareholders
anheuser-busch 2006AR_LetterToShareholdersfinance15
 
Presentation ASB
Presentation ASBPresentation ASB
Presentation ASBRene Looper
 
New creative economy pwp
New creative economy pwpNew creative economy pwp
New creative economy pwpOntarioEast
 
What's New in Search Engine Market (2009 review)
What's New in Search Engine Market (2009 review)What's New in Search Engine Market (2009 review)
What's New in Search Engine Market (2009 review)Angus Li
 

Andere mochten auch (6)

anheuser-busch 2006AR_LetterToShareholders
anheuser-busch 2006AR_LetterToShareholdersanheuser-busch 2006AR_LetterToShareholders
anheuser-busch 2006AR_LetterToShareholders
 
Presentation ASB
Presentation ASBPresentation ASB
Presentation ASB
 
New creative economy pwp
New creative economy pwpNew creative economy pwp
New creative economy pwp
 
DME
DMEDME
DME
 
Irlande Johanne Mathilde
Irlande Johanne MathildeIrlande Johanne Mathilde
Irlande Johanne Mathilde
 
What's New in Search Engine Market (2009 review)
What's New in Search Engine Market (2009 review)What's New in Search Engine Market (2009 review)
What's New in Search Engine Market (2009 review)
 

Ähnlich wie The Spoofax Language Workbench for Building Domain-Specific Languages

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 Art Of Readable Code
The Art Of Readable CodeThe Art Of Readable Code
The Art Of Readable CodeBaidu, Inc.
 
Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#Robert Pickering
 
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Flink Forward
 
AestasIT - Internal DSLs in Scala
AestasIT - Internal DSLs in ScalaAestasIT - Internal DSLs in Scala
AestasIT - Internal DSLs in ScalaDmitry Buzdin
 
Measuring Your Code
Measuring Your CodeMeasuring Your Code
Measuring Your CodeNate Abele
 
Measuring Your Code 2.0
Measuring Your Code 2.0Measuring Your Code 2.0
Measuring Your Code 2.0Nate Abele
 
Software Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & SpoofaxSoftware Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & SpoofaxEelco Visser
 
Hands on Mahout!
Hands on Mahout!Hands on Mahout!
Hands on Mahout!OSCON Byrum
 
Core .NET Framework 4.0 Enhancements
Core .NET Framework 4.0 EnhancementsCore .NET Framework 4.0 Enhancements
Core .NET Framework 4.0 EnhancementsRobert MacLean
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_netNico Ludwig
 
C sharp 8.0 new features
C sharp 8.0 new featuresC sharp 8.0 new features
C sharp 8.0 new featuresMSDEVMTL
 
More Data, More Problems: Evolving big data machine learning pipelines with S...
More Data, More Problems: Evolving big data machine learning pipelines with S...More Data, More Problems: Evolving big data machine learning pipelines with S...
More Data, More Problems: Evolving big data machine learning pipelines with S...Alex Sadovsky
 
Cadence GenusTutorial------------ .pdf.pdf
Cadence GenusTutorial------------ .pdf.pdfCadence GenusTutorial------------ .pdf.pdf
Cadence GenusTutorial------------ .pdf.pdfSamHoney6
 
Linq 1224887336792847 9
Linq 1224887336792847 9Linq 1224887336792847 9
Linq 1224887336792847 9google
 
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali ZaidiNatural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali ZaidiDatabricks
 
Michael Hall [InfluxData] | Become an InfluxDB Pro in 20 Minutes | InfluxDays...
Michael Hall [InfluxData] | Become an InfluxDB Pro in 20 Minutes | InfluxDays...Michael Hall [InfluxData] | Become an InfluxDB Pro in 20 Minutes | InfluxDays...
Michael Hall [InfluxData] | Become an InfluxDB Pro in 20 Minutes | InfluxDays...InfluxData
 

Ähnlich wie The Spoofax Language Workbench for Building Domain-Specific Languages (20)

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 Art Of Readable Code
The Art Of Readable CodeThe Art Of Readable Code
The Art Of Readable Code
 
Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#Combinators, DSLs, HTML and F#
Combinators, DSLs, HTML and F#
 
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
Introducing BinarySortedMultiMap - A new Flink state primitive to boost your ...
 
AestasIT - Internal DSLs in Scala
AestasIT - Internal DSLs in ScalaAestasIT - Internal DSLs in Scala
AestasIT - Internal DSLs in Scala
 
Measuring Your Code
Measuring Your CodeMeasuring Your Code
Measuring Your Code
 
Measuring Your Code 2.0
Measuring Your Code 2.0Measuring Your Code 2.0
Measuring Your Code 2.0
 
Software Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & SpoofaxSoftware Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & Spoofax
 
Hands on Mahout!
Hands on Mahout!Hands on Mahout!
Hands on Mahout!
 
CoCoViLa @ devclub.eu
CoCoViLa @ devclub.euCoCoViLa @ devclub.eu
CoCoViLa @ devclub.eu
 
Core .NET Framework 4.0 Enhancements
Core .NET Framework 4.0 EnhancementsCore .NET Framework 4.0 Enhancements
Core .NET Framework 4.0 Enhancements
 
Scam 08
Scam 08Scam 08
Scam 08
 
(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net(1) c sharp introduction_basics_dot_net
(1) c sharp introduction_basics_dot_net
 
C sharp 8.0 new features
C sharp 8.0 new featuresC sharp 8.0 new features
C sharp 8.0 new features
 
More Data, More Problems: Evolving big data machine learning pipelines with S...
More Data, More Problems: Evolving big data machine learning pipelines with S...More Data, More Problems: Evolving big data machine learning pipelines with S...
More Data, More Problems: Evolving big data machine learning pipelines with S...
 
Cadence GenusTutorial------------ .pdf.pdf
Cadence GenusTutorial------------ .pdf.pdfCadence GenusTutorial------------ .pdf.pdf
Cadence GenusTutorial------------ .pdf.pdf
 
Python basics
Python basicsPython basics
Python basics
 
Linq 1224887336792847 9
Linq 1224887336792847 9Linq 1224887336792847 9
Linq 1224887336792847 9
 
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali ZaidiNatural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
 
Michael Hall [InfluxData] | Become an InfluxDB Pro in 20 Minutes | InfluxDays...
Michael Hall [InfluxData] | Become an InfluxDB Pro in 20 Minutes | InfluxDays...Michael Hall [InfluxData] | Become an InfluxDB Pro in 20 Minutes | InfluxDays...
Michael Hall [InfluxData] | Become an InfluxDB Pro in 20 Minutes | InfluxDays...
 

Mehr von Devnology

What do we really know about the differences between static and dynamic types?
What do we really know about the differences between static and dynamic types?What do we really know about the differences between static and dynamic types?
What do we really know about the differences between static and dynamic types?Devnology
 
Meetup at SIG: Meten is weten
Meetup at SIG: Meten is wetenMeetup at SIG: Meten is weten
Meetup at SIG: Meten is wetenDevnology
 
Software Operation Knowledge
Software Operation KnowledgeSoftware Operation Knowledge
Software Operation KnowledgeDevnology
 
Slides Felienne Hermans Symposium EWI
Slides Felienne Hermans Symposium EWISlides Felienne Hermans Symposium EWI
Slides Felienne Hermans Symposium EWIDevnology
 
Devnology auteursrecht en open source 20130205
Devnology auteursrecht en open source 20130205Devnology auteursrecht en open source 20130205
Devnology auteursrecht en open source 20130205Devnology
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applicationsDevnology
 
Hacking Smartcards & RFID
Hacking Smartcards & RFIDHacking Smartcards & RFID
Hacking Smartcards & RFIDDevnology
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISPDevnology
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISPDevnology
 
Devnology Back to School: Empirical Evidence on Modeling in Software Development
Devnology Back to School: Empirical Evidence on Modeling in Software DevelopmentDevnology Back to School: Empirical Evidence on Modeling in Software Development
Devnology Back to School: Empirical Evidence on Modeling in Software DevelopmentDevnology
 
Devnology Back to School IV - Agility en Architectuur
Devnology Back to School IV - Agility en ArchitectuurDevnology Back to School IV - Agility en Architectuur
Devnology Back to School IV - Agility en ArchitectuurDevnology
 
Devnology Back to School III : Software impact
Devnology Back to School III : Software impactDevnology Back to School III : Software impact
Devnology Back to School III : Software impactDevnology
 
Devnology back toschool software reengineering
Devnology back toschool software reengineeringDevnology back toschool software reengineering
Devnology back toschool software reengineeringDevnology
 
Introduction to Software Evolution: The Software Volcano
Introduction to Software Evolution: The Software VolcanoIntroduction to Software Evolution: The Software Volcano
Introduction to Software Evolution: The Software VolcanoDevnology
 
Devnology Workshop Genpro 2 feb 2011
Devnology Workshop Genpro 2 feb 2011Devnology Workshop Genpro 2 feb 2011
Devnology Workshop Genpro 2 feb 2011Devnology
 
Devnology Coding Dojo 05-01-2011
Devnology Coding Dojo 05-01-2011Devnology Coding Dojo 05-01-2011
Devnology Coding Dojo 05-01-2011Devnology
 
Experimenting with Augmented Reality
Experimenting with Augmented RealityExperimenting with Augmented Reality
Experimenting with Augmented RealityDevnology
 
Unit testing and MVVM in Silverlight
Unit testing and MVVM in SilverlightUnit testing and MVVM in Silverlight
Unit testing and MVVM in SilverlightDevnology
 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingDevnology
 
Devnology Fitnesse workshop
Devnology Fitnesse workshopDevnology Fitnesse workshop
Devnology Fitnesse workshopDevnology
 

Mehr von Devnology (20)

What do we really know about the differences between static and dynamic types?
What do we really know about the differences between static and dynamic types?What do we really know about the differences between static and dynamic types?
What do we really know about the differences between static and dynamic types?
 
Meetup at SIG: Meten is weten
Meetup at SIG: Meten is wetenMeetup at SIG: Meten is weten
Meetup at SIG: Meten is weten
 
Software Operation Knowledge
Software Operation KnowledgeSoftware Operation Knowledge
Software Operation Knowledge
 
Slides Felienne Hermans Symposium EWI
Slides Felienne Hermans Symposium EWISlides Felienne Hermans Symposium EWI
Slides Felienne Hermans Symposium EWI
 
Devnology auteursrecht en open source 20130205
Devnology auteursrecht en open source 20130205Devnology auteursrecht en open source 20130205
Devnology auteursrecht en open source 20130205
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
 
Hacking Smartcards & RFID
Hacking Smartcards & RFIDHacking Smartcards & RFID
Hacking Smartcards & RFID
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISP
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISP
 
Devnology Back to School: Empirical Evidence on Modeling in Software Development
Devnology Back to School: Empirical Evidence on Modeling in Software DevelopmentDevnology Back to School: Empirical Evidence on Modeling in Software Development
Devnology Back to School: Empirical Evidence on Modeling in Software Development
 
Devnology Back to School IV - Agility en Architectuur
Devnology Back to School IV - Agility en ArchitectuurDevnology Back to School IV - Agility en Architectuur
Devnology Back to School IV - Agility en Architectuur
 
Devnology Back to School III : Software impact
Devnology Back to School III : Software impactDevnology Back to School III : Software impact
Devnology Back to School III : Software impact
 
Devnology back toschool software reengineering
Devnology back toschool software reengineeringDevnology back toschool software reengineering
Devnology back toschool software reengineering
 
Introduction to Software Evolution: The Software Volcano
Introduction to Software Evolution: The Software VolcanoIntroduction to Software Evolution: The Software Volcano
Introduction to Software Evolution: The Software Volcano
 
Devnology Workshop Genpro 2 feb 2011
Devnology Workshop Genpro 2 feb 2011Devnology Workshop Genpro 2 feb 2011
Devnology Workshop Genpro 2 feb 2011
 
Devnology Coding Dojo 05-01-2011
Devnology Coding Dojo 05-01-2011Devnology Coding Dojo 05-01-2011
Devnology Coding Dojo 05-01-2011
 
Experimenting with Augmented Reality
Experimenting with Augmented RealityExperimenting with Augmented Reality
Experimenting with Augmented Reality
 
Unit testing and MVVM in Silverlight
Unit testing and MVVM in SilverlightUnit testing and MVVM in Silverlight
Unit testing and MVVM in Silverlight
 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
 
Devnology Fitnesse workshop
Devnology Fitnesse workshopDevnology Fitnesse workshop
Devnology Fitnesse workshop
 

Kürzlich hochgeladen

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 

Kürzlich hochgeladen (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 

The Spoofax Language Workbench for Building Domain-Specific Languages

  • 1. The Spoofax Language Workbench Eelco Visser Lennart Kats Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
  • 3. Domain-Specific Languages (DSLs) Domain: • Mobile phone • Web • Financial • Printer design • ... Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology Can offer: • Specialized syntax • Specialized analysis • Specialized optimizations • Platform independence
  • 4. Example DSL: Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
  • 5. Syntax definition ★ concrete + abstract syntax Static semantics ★ error checking ★ name resolution ★ type analysis Model-to-model transformation ★ express constructs in core language Code generation ★ translate core language models to implementation Problem: building DSLs parser generators meta- programming languages meta- programming libraries template engines Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
  • 6. Problem: building DSLs (ct’d) Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
  • 7. Editor Services syntactic editor services • syntax highlighting • syntax checking • outline view • bracket matching, insertion • automatic indentation • syntax completion • ... semantic editor services • error marking • reference resolving • hover help • mark occurrences • content completion • refactoring • ... Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
  • 8. Syntax definition Static semantics Model-to-model transformation Code generation Syntactic Editor Services Semantic Editor Services }Spoofax how can we make these things cheaply? Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
  • 9. • <spoofax screenshot: lang def and lang use in Eclipse workspace> Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
  • 10. #1 Syntax definition • Basic expression language 1+2+3 Expr “+” Expr -> Expr {cons(“Plus”)} Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
  • 11. #1 Syntax definition • Basic expression language 1+2+3 2 1 3 + + 21 3 + + is that or ? what does the abstract syntax view say?
  • 12. #1 Syntax definition • Basic expression language 1+2*3 2 1 3 + * 21 3 *is that or ? what does the abstract syntax view say? +
  • 13. The Spoofax Solution: Declarative Syntax with SDF Declarative, explicit disambigation rules Clean abstract syntax Composable syntax definitions
  • 14. #2 Transformation Tip. Some other operators: subtS, mulS, divS, gt, lt, eq Transform 1+2 to <addition of> 1 and 2: calc: Add(Int(i), Int(j)) -> Int(<addS> (i, j))
  • 15. #2 Transformation Transform 1+2 to <addition of> 1 and 2: calc: Add(Int(i), Int(j)) -> Int(<addS> (i, j)) calculate = bottomup(try(calc)) Tip. Some other operators: subtS, mulS, divS, gt, lt, eq
  • 16. #3 Equations New syntax New semantics x = 2 y = 3 result = 90 * x + 30 * y
  • 17. #3 Equations x = 2 y = 3 result = 90 * x + 30 * y Assign(“x”, INT(2)) calc: Assign(x, e) -> e where rules(GetValue: x -> e) calc: Var(x) -> <GetValue> x New syntax New semantics
  • 18. x = 2 y = 3 result = 90 * x + 30 * z #4 Error markers (Var(“z”), “Variable z is not defined”) transform
  • 19. #4 Error markers analyze = topdown(try(record-var)) record-var: Assign(x, e) -> Assign(x, e) with rules( GetVar :+ x -> e ) constraint-errors = collect-all(constraint-error, conc) constraint-error: Var(x) -> (x, $[Variable [x] is not defined]) where not(<GetVar> x)
  • 20. #4 Error markers #5 Refinement analyze = topdown(try(record-var)) record-var: Assign(x, e) -> Assign(x, e) with rules( GetVar :+ x -> e ) constraint-errors = collect-all(constraint-error, conc) constraint-error: Var(x) -> (x, $[Variable [x] is not defined]) where not(<GetVar> x)
  • 21. #4 Error markers #5 Refinement editor-resolve: (Var(x), position, ast, path, project-path) -> target where target := <GetVar> x editor-complete: (Var(x), position, ast, path, project-path) -> proposals where proposals := <all-keys-GetVar> x
  • 23. Syntax definition Static semantics Model-to-model transformation Code generation Syntactic Editor Services Semantic Editor Services }Spoofax www.spoofax.org