SlideShare a Scribd company logo
1 of 47
Download to read offline
The Spoofax
Language Workbench

    Lennart Kats   Eelco Visser
Software Engineering


          implement

Problem                Software
            validate
High-level languages reduce
   problem/solution gap

Problem
                HLL    Machine
Domain
Domain-Specific Languages


Problem
                    DSL                HLL             Machine
Domain




DSLs further reduce gap between problem domain and implementation
Example DSL:
paradigm: linguistic abstraction
making languages should be cheap
Compiler Ingredients
Syntax definition
   ★ concrete syntax
   ★ abstract syntax       parser
Static semantics         generators
                                                 meta-
   ★ error checking                          programming
   ★ name resolution                           libraries
   ★ type analysis     meta-
                   programming
Model-to-model transformation
                     languages
   ★ express constructs in core language       template
Code generation                                 engines
   ★ translate core language models to implementation
Editor Services
syntactic editor services         semantic editor services

•   syntax highlighting           •   error marking

•   syntax checking               •   reference resolving

•   outline view                  •   hover help

•   bracket matching, insertion   •   mark occurrences

•   automatic indentation         •   content completion

•   syntax completion             •   refactoring

•   ...                           •   ...
Syntax definition
Static semantics
Model-to-model transformation        Language
Code generation                    workbenches
Syntactic Editor Services          [Fowler ’05]
Semantic Editor Services


     how can we make these things cheaply?
Language Workbench:

integrated environment for language definition
Holy Grail of Software Language Definition




  Automatically derive efficient,
scalable, incremental compiler +
 usable IDE from high-level,
 declarative language
      definition
Stratego


SDF              Eclipse


        IMP
Stratego

                    on by
               ni ti
SDF        D efi ion   Eclipse
        ge
      ua form   at
    ng ns
 La ra
     T
            IMP
• <spoofax screenshot: lang def and lang use
  in Eclipse workspace>
SDF:
Declarative
  Syntax
 Definition
A   syntax definition
specifies a transformation
       from text to trees
Syntax as Transformation
Syntax as Transformation
Syntax as Transformation




                     transform
Syntax as Transformation




                     transform
Syntax as Transformation




                     transform
Semantics
      =
transformation
Error Marking is a
 Transformation




                     transform
Error Marking is a
 Transformation




                     transform
Error Marking is a
 Transformation




                     transform
     transform
Error Marking is a
 Transformation




                     transform
     transform
Error Marking is a
 Transformation




                     transform
     transform
Outline View is a
Transformation



      transform
Hyperlinking is a
   Transformation
      m
 sfor
tran
Content Completion is a
   Transformation
             orm
      tsfa rm
       ro nsf
  tran
Code Generation is a
  Transformation



         transform
Need for single, unified language specification:
• Editor services
• Model transformations
• Code generation
Stratego:
Rewriting
Language
Rewrite rules


 Strategies
Error Marking with Rewrite Rules
Error Marking with Rewrite Rules
Error Marking with Rewrite Rules




                                  transform
                Origin tracking


              transform
Analysis with Rewrite Rules
Code Generation with Rewrite Rules
Conclusion

• Co-evolution of language and IDE
• Pure and declarative syntax definition
• Language definition by transformation

• www.spoofax.org: papers, tour, download

More Related Content

What's hot (18)

Community Tech Days C# 4.0
Community Tech Days C# 4.0Community Tech Days C# 4.0
Community Tech Days C# 4.0
 
LIL Presentation
LIL PresentationLIL Presentation
LIL Presentation
 
C# language
C# languageC# language
C# language
 
Emscripten - compile your C/C++ to JavaScript
Emscripten - compile your C/C++ to JavaScriptEmscripten - compile your C/C++ to JavaScript
Emscripten - compile your C/C++ to JavaScript
 
.Net
.Net.Net
.Net
 
C++ to java
C++ to javaC++ to java
C++ to java
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
A First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming Language
 
Programming Language Selection
Programming Language SelectionProgramming Language Selection
Programming Language Selection
 
Introduction to Go-Lang
Introduction to Go-LangIntroduction to Go-Lang
Introduction to Go-Lang
 
Python for Swift
Python for SwiftPython for Swift
Python for Swift
 
F# for Scala developers
F# for Scala developersF# for Scala developers
F# for Scala developers
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
An Introduction to PyPy
An Introduction to PyPyAn Introduction to PyPy
An Introduction to PyPy
 
Difference between c, c++ and java
Difference between c, c++ and javaDifference between c, c++ and java
Difference between c, c++ and java
 
PyPy
PyPyPyPy
PyPy
 
difference between c c++ c#
difference between c c++ c#difference between c c++ c#
difference between c c++ c#
 
a quick Introduction to PyPy
a quick Introduction to PyPya quick Introduction to PyPy
a quick Introduction to PyPy
 

Similar to DSLs further reduce gap between problem domain and implementation

Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processorsRebaz Najeeb
 
Interference with High level language.pdf
Interference with High level language.pdfInterference with High level language.pdf
Interference with High level language.pdfARslan Ahmad
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design BasicsAkhil Kaushik
 
JetBrains MPS: Projectional Editing in Domain-Specific Languages
JetBrains MPS: Projectional Editing in Domain-Specific LanguagesJetBrains MPS: Projectional Editing in Domain-Specific Languages
JetBrains MPS: Projectional Editing in Domain-Specific LanguagesOscar Rodriguez
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design BasicsAkhil Kaushik
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to CompilersAkhil Kaushik
 
Principles of Compiler Design - Introduction
Principles of Compiler Design - IntroductionPrinciples of Compiler Design - Introduction
Principles of Compiler Design - Introductionsheelarajasekar205
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compilerIffat Anjum
 
mbeddr meets IncQuer - Combining the Best Features of Two Modeling Worlds
mbeddr meets IncQuer - Combining the Best Features of Two Modeling Worldsmbeddr meets IncQuer - Combining the Best Features of Two Modeling Worlds
mbeddr meets IncQuer - Combining the Best Features of Two Modeling WorldsIstvan Rath
 
Intro to Programming Lang.pptx
Intro to Programming Lang.pptxIntro to Programming Lang.pptx
Intro to Programming Lang.pptxssuser51ead3
 
Challenges In Dsl Design
Challenges In Dsl DesignChallenges In Dsl Design
Challenges In Dsl DesignSven Efftinge
 
From Programming to Modeling And Back Again
From Programming to Modeling And Back AgainFrom Programming to Modeling And Back Again
From Programming to Modeling And Back AgainMarkus Voelter
 
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Professor Lili Saghafi
 
Java beyond Java - from the language to platform
Java beyond Java - from the language to platformJava beyond Java - from the language to platform
Java beyond Java - from the language to platformNaresha K
 
Language Engineering With Xtext
Language Engineering With XtextLanguage Engineering With Xtext
Language Engineering With XtextSven Efftinge
 
Architecting Domain-Specific Languages
Architecting Domain-Specific LanguagesArchitecting Domain-Specific Languages
Architecting Domain-Specific LanguagesMarkus Voelter
 
RAPID - Building a highly usable API Design language with XText
RAPID - Building a highly usable API Design language with XTextRAPID - Building a highly usable API Design language with XText
RAPID - Building a highly usable API Design language with XTextTed Epstein
 

Similar to DSLs further reduce gap between problem domain and implementation (20)

Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
 
Interference with High level language.pdf
Interference with High level language.pdfInterference with High level language.pdf
Interference with High level language.pdf
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
JetBrains MPS: Projectional Editing in Domain-Specific Languages
JetBrains MPS: Projectional Editing in Domain-Specific LanguagesJetBrains MPS: Projectional Editing in Domain-Specific Languages
JetBrains MPS: Projectional Editing in Domain-Specific Languages
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
Compilers.pptx
Compilers.pptxCompilers.pptx
Compilers.pptx
 
Introduction to Compilers
Introduction to CompilersIntroduction to Compilers
Introduction to Compilers
 
Principles of Compiler Design - Introduction
Principles of Compiler Design - IntroductionPrinciples of Compiler Design - Introduction
Principles of Compiler Design - Introduction
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
mbeddr meets IncQuer - Combining the Best Features of Two Modeling Worlds
mbeddr meets IncQuer - Combining the Best Features of Two Modeling Worldsmbeddr meets IncQuer - Combining the Best Features of Two Modeling Worlds
mbeddr meets IncQuer - Combining the Best Features of Two Modeling Worlds
 
Intro to Programming Lang.pptx
Intro to Programming Lang.pptxIntro to Programming Lang.pptx
Intro to Programming Lang.pptx
 
Challenges In Dsl Design
Challenges In Dsl DesignChallenges In Dsl Design
Challenges In Dsl Design
 
LANGUAGE TRANSLATOR
LANGUAGE TRANSLATORLANGUAGE TRANSLATOR
LANGUAGE TRANSLATOR
 
From Programming to Modeling And Back Again
From Programming to Modeling And Back AgainFrom Programming to Modeling And Back Again
From Programming to Modeling And Back Again
 
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
Programming Languages Categories / Programming Paradigm By: Prof. Lili Saghafi
 
Java beyond Java - from the language to platform
Java beyond Java - from the language to platformJava beyond Java - from the language to platform
Java beyond Java - from the language to platform
 
4. processor
4. processor4. processor
4. processor
 
Language Engineering With Xtext
Language Engineering With XtextLanguage Engineering With Xtext
Language Engineering With Xtext
 
Architecting Domain-Specific Languages
Architecting Domain-Specific LanguagesArchitecting Domain-Specific Languages
Architecting Domain-Specific Languages
 
RAPID - Building a highly usable API Design language with XText
RAPID - Building a highly usable API Design language with XTextRAPID - Building a highly usable API Design language with XText
RAPID - Building a highly usable API Design language with XText
 

DSLs further reduce gap between problem domain and implementation