SlideShare une entreprise Scribd logo
1  sur  39
Télécharger pour lire hors ligne
Domain-Specific Langua ges for
   Composable Editor Plugins




LDTA 2009, York, UK

Lennart Kats (me),     Delft University of Technology
Karl Trygve Kalleberg, University of Bergen
Eelco Visser,          Delft University of Technology
March 19, 2009



Software Engineering Research Group
The Framework
     is the
  Language
The IDE
  is the
Language
Implementing IDEs:
The Two Faces of Eclipse

Eclipse platform:
• Cross-platform, open-source
• People have it
• People use it
   • Java, ...
Implementing IDEs:
The Two Faces of Eclipse

Huge, low-level API
• SWT widgets
• synchronization
• I/O
• regexes
Implementing IDEs:
The Two Faces of Eclipse

Weakly typed interfaces
• XML
• java.lang.Object, IAdaptable
• CoreException
  "A checked exception representing a failure."
II.
Composable
Languages
DSLs and Language Extensions

Domain-specific         void browse() {
                          List<Book> books =
• Database queries
                           <| SELECT *
• Regular expressions          FROM books
• XML processing               WHERE price < 100.00
                             |>;
• Matrices
• Complex numbers           …
• ...
                            for (int i = 0; i < books.size(); i++)
                               books.get(i).title =~ s/^The //;
                        }
Meta-programming with
Concrete Object Syntax
• Program transformation
• Stratego with WebDSL, Java, XML


    webdsl-action-to-java-method:
     |[ action x_action(farg*) { stat* } ]| ->
     |[ public void x_action(param*) { bstm* } ]|
     with param* := <map(action-arg-to-java)> farg*;
           bstm* := <statements-to-java> stat*
III.
Introducing
Spoofax/IMP
IDE development environments
(Or: How to Learn to Stop Worrying and Love Eclipse)

• Abstraction
   • avoid Eclipse framework complexity
• Modularity
   • separation of concerns
   • reuse
• Extensibility and customization
   • integration with existing compilers, tools
Introducing Spoofax/IMP

• Three pillars:
   • SDF grammars
   • DSLs for service descriptors
   • Implemented using
     Spoofax and IMP frameworks (“SAFARI”)
An IDE plugin created with Spoofax/IMP
SDF and SGLR (1)

• Unified lexical and context-free syntax

  module WebDSL
  imports MixHQL[HQL] AccessControl ...
  exports
   lexical syntax
     [a-zA-Z][a-zA-Z0-9_]* → Id
     ...
   context-free syntax
     "module" Id Section*              → Unit    {cons("Module")}
     "section" SectionName Def*        → Section {cons("Section")}
     "define" Mod* Id "{" Element* "}" → Def     {cons("SimpleDef")}
     ...
SDF and SGLR (2)

• Scannerless Generalized-LR Parsing
   • Full class of context-free grammars
   • Compositional
   • Declarative disambiguation filters



                   module Stratego-WebDSL-Java-XML
                   imports
                    Stratego-Java-15
                    Stratego-WebDSL
                    Stratego-XML
Modular Editor Service Definitions

• Main file
• Definition for each service
• Generated definitions
Reuse and Modularity in IDE plugins

  Stratego + WebDSL editor =
  StrategoWebDSL editor

• Declarative specifications
• (Backdoor available)
Creating a brand new IDE plugin

Requires:             Gives you:
• Syntax definition   • Service templates
• Language name       • Generated services
• File extension(s)   • plugin.xml, ...

                      And:
                      • Basic IDE functionality:
                        Coloring, outline, folding
In the Beginning: WebDSL.main.esv
module WebDSL.main

imports
 WebDSL-Analysis WebDSL-Colorer WebDSL-...

language Description

 name : WebDSL
 aliases : WebDiesel
 id      : org.strategoxt.imp.generated.webdsl

 description : "Spoofax/IMP-generated editor for the WebDSL language"
 url         : http://strategoxt.org

language Files and parsing

 [...]
In the Beginning: WebDSL.main.esv
module WebDSL.main

imports
 WebDSL-Analysis WebDSL-...
                 WebDSL-Colorer WebDSL-...

language Description

 [...]

language Files and parsing

 extensions
 [...]         : app
 table         : include/WebDSL.tbl
 start symbols : Unit
In the Beginning (2): Generated Services
• Based on heuristics
• Rapid prototyping
• Starting point
   • functioning as an example
   • self-documenting

module WebDSL-Colorer.generated

// ...documentation...

colorer Default highlighting rules
 keyword : "Keywords" = magenta bold
 string   : "Strings"    = blue
 number : "Numbers" = darkgreen
 ...
Example: The colorer service
                    module Stratego-WebDSL-Colorer

                    imports
                     Stratego
                     WebDSL

                    colorer Variables

                     _.Var : green italic

                    colorer Concrete syntax

                     environment _.ToMetaExpr:
                      _ gray

                     environment _.FromMetaExpr:
                      _ white
Example: The folding service
                    module Java-Folding

                    imports
                     Java-Folding.generated

                    folding Customization

                     CompilationUnit
                     NewInstance
                     QNewInstance

                     ImportDec* (folded)
                     Block      (disable)
Syntactic Editor Services

•   Syntax errors
•   Code folding
•   Outline view
•   Brace matching
•   Comments
•   Source code formatting
Semantic Editor Services

•   Error reporting
•   Reference resolving
•   Reference info
•   Occurrence highlighting
Stratego integration


Stratego:
• Rewrite rules
• Strategies to control
   their application
• Used for e.g., WebDSL, Stratego, Java   [OOPSLA'08]
Interfacing with Stratego
• Interface based on rewrite rules
• Adapted primitives for parsing, caching

                              Offending term + message tuples
                                 [(Var(“auhtor”), “undeclared”), ...]

editor­analyze:
  (ast, path, fullpath) ­> (errors, warnings, infos)
  with
    ...
    (errors, warnings, infos) := <collect­all­markers> ast
    ...
Interfacing with Stratego
• Interface based on rewrite rules
• Adapted primitives for parsing, caching

                               Referenced declaration
                                 Property(“author”, ...)

reference­resolve:
  (ast, path, fullpath, reference) ­> declaration
  with
    ...
    declaration := <find­decl> reference
    ...
Using Stratego:
   A Global-to-Local Transformation
entity User {
  username :: String (id)               entity User {
  password :: Secret                      username :: String (id)
  isAdmin :: Bool                         password :: Secret
}                                         isAdmin :: Bool
                            normalize     name       :: String
                                          manager -> User
extend entity User {                      employees -> Set<User>
  name      :: String                   }
  manager -> User
  employees -> Set<User>
}
Term Rewriting with Origin Tracking
                                        [Van Deursen et al 1993]

entity User {
  username :: String (id)                  entity User {
  password :: Secret                         username :: String (id)
  isAdmin :: Bool                            password :: Secret
}                                            isAdmin :: Bool
                            normalize        name       :: String
                                             manager -> User
extend entity User {                         employees -> Set<User>
  name      :: String                      }
  manager -> User
  employees -> Set<User>
}
Program Object Model (POM) adapter
                            [Kalleberg et al, LDTA'07]

Interpret term operations as API calls
• Using Spoofax interpreter
• Intercept applications of rewrite rules
   in strategies
• Override term building, 'all', 'some', and 'one'
   for origin tracking
The Ubiquitous Eclipse
Dynamic Building and Loading:
The Editor Service Builder
• Verifies all service descriptors
   • Syntax
   • Existing sorts
   • ...
• Updates plugin.xml, etc.
• Builds parse tables
Dynamic Building and Loading:
Dynamically Loading Editor Services
                                     <<language>>
• IMP provides:                    DynamicRoot
                            DynamicColor : Colorer
   • static, XML-based      dynamicFolder : Folder
     editor declarations    ...

   • language inheritance
                                     <<language>>
                                       WebDSL
• Base language
   • Defines default services
   • May be overridden
     by dynamic or “backdoor” implementations
Looking back

LDTA'07: Spoofax




                   Embedded Java code
Looking back

LDTA'08: sdf2imp

No:
• Semantic services
• Dynamic loading
• Modular definitions
Looking forward (to)

• Complete Stratego-based DSL environment
   • compiler for Java
   • SDF bundle
• Expansion of editor services
   • e.g. content completion
Looking forward (to)

• Integration with Aster [CC 2009]
• Better interactive parser
   • performance
   • error handling
   • content completion
Concluding Remarks
    • Declarative DSLs
      • Avoid Eclipse API complexity
      • Specialized syntax
      • Compositionality
      • Co-evolution of language and IDE


Domain­Specific Languages for Composable Editor Plugins.
Lennart C. L. Kats, Karl T. Kalleberg, and Eelco Visser. LDTA 2009.

http://www.strategoxt.org/Stratego/Spoofax­IMP

Contenu connexe

Tendances

Scoobi - Scala for Startups
Scoobi - Scala for StartupsScoobi - Scala for Startups
Scoobi - Scala for Startupsbmlever
 
Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Michelangelo van Dam
 
11. session 11 functions and objects
11. session 11   functions and objects11. session 11   functions and objects
11. session 11 functions and objectsPhúc Đỗ
 
concurrency gpars
concurrency gparsconcurrency gpars
concurrency gparsPaul King
 
Kotlin @ Coupang Backend 2017
Kotlin @ Coupang Backend 2017Kotlin @ Coupang Backend 2017
Kotlin @ Coupang Backend 2017Sunghyouk Bae
 
concurrency with GPars
concurrency with GParsconcurrency with GPars
concurrency with GParsPaul King
 
GPars (Groovy Parallel Systems)
GPars (Groovy Parallel Systems)GPars (Groovy Parallel Systems)
GPars (Groovy Parallel Systems)Gagan Agrawal
 
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018Sunghyouk Bae
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Jonas Bonér
 
awesome groovy
awesome groovyawesome groovy
awesome groovyPaul King
 
Alternatives of JPA/Hibernate
Alternatives of JPA/HibernateAlternatives of JPA/Hibernate
Alternatives of JPA/HibernateSunghyouk Bae
 

Tendances (20)

Scoobi - Scala for Startups
Scoobi - Scala for StartupsScoobi - Scala for Startups
Scoobi - Scala for Startups
 
Dartprogramming
DartprogrammingDartprogramming
Dartprogramming
 
Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010Advanced Php - Macq Electronique 2010
Advanced Php - Macq Electronique 2010
 
11. session 11 functions and objects
11. session 11   functions and objects11. session 11   functions and objects
11. session 11 functions and objects
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Scala DSLの作り方
Scala DSLの作り方Scala DSLの作り方
Scala DSLの作り方
 
concurrency gpars
concurrency gparsconcurrency gpars
concurrency gpars
 
Requery overview
Requery overviewRequery overview
Requery overview
 
Kotlin @ Coupang Backend 2017
Kotlin @ Coupang Backend 2017Kotlin @ Coupang Backend 2017
Kotlin @ Coupang Backend 2017
 
Scalding for Hadoop
Scalding for HadoopScalding for Hadoop
Scalding for Hadoop
 
concurrency with GPars
concurrency with GParsconcurrency with GPars
concurrency with GPars
 
GPars (Groovy Parallel Systems)
GPars (Groovy Parallel Systems)GPars (Groovy Parallel Systems)
GPars (Groovy Parallel Systems)
 
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)
 
Spring data
Spring dataSpring data
Spring data
 
Dart
DartDart
Dart
 
The Xtext Grammar Language
The Xtext Grammar LanguageThe Xtext Grammar Language
The Xtext Grammar Language
 
Xtext Eclipse Con
Xtext Eclipse ConXtext Eclipse Con
Xtext Eclipse Con
 
awesome groovy
awesome groovyawesome groovy
awesome groovy
 
Alternatives of JPA/Hibernate
Alternatives of JPA/HibernateAlternatives of JPA/Hibernate
Alternatives of JPA/Hibernate
 

Similaire à Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)

Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLsintelliyole
 
Lightbend Lagom: Microservices Just Right
Lightbend Lagom: Microservices Just RightLightbend Lagom: Microservices Just Right
Lightbend Lagom: Microservices Just Rightmircodotta
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)Daniel Bryant
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...Fabio Franzini
 
Angular JS2 Training Session #1
Angular JS2 Training Session #1Angular JS2 Training Session #1
Angular JS2 Training Session #1Paras Mendiratta
 
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-MallaKerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-MallaSpark Summit
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet IntroductionWei Sun
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government DevelopersFrank La Vigne
 
Building DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchBuilding DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchEelco Visser
 
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...Michael Rys
 
Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffJAX London
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Codemotion
 
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
 

Similaire à Domain-Specific Languages for Composable Editor Plugins (LDTA 2009) (20)

Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
Grails 101
Grails 101Grails 101
Grails 101
 
Lightbend Lagom: Microservices Just Right
Lightbend Lagom: Microservices Just RightLightbend Lagom: Microservices Just Right
Lightbend Lagom: Microservices Just Right
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
 
WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...WebNet Conference 2012 - Designing complex applications using html5 and knock...
WebNet Conference 2012 - Designing complex applications using html5 and knock...
 
Angular JS2 Training Session #1
Angular JS2 Training Session #1Angular JS2 Training Session #1
Angular JS2 Training Session #1
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Slickdemo
SlickdemoSlickdemo
Slickdemo
 
Liferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for DevelopersLiferay (DXP) 7 Tech Meetup for Developers
Liferay (DXP) 7 Tech Meetup for Developers
 
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-MallaKerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
 
Scala and Spring
Scala and SpringScala and Spring
Scala and Spring
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet Introduction
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government Developers
 
Knolx session
Knolx sessionKnolx session
Knolx session
 
Building DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language WorkbenchBuilding DSLs with the Spoofax Language Workbench
Building DSLs with the Spoofax Language Workbench
 
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
U-SQL Killer Scenarios: Taming the Data Science Monster with U-SQL and Big Co...
 
Spring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard WolffSpring Day | Spring and Scala | Eberhard Wolff
Spring Day | Spring and Scala | Eberhard Wolff
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
 
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)
 
Lobos Introduction
Lobos IntroductionLobos Introduction
Lobos Introduction
 

Plus de lennartkats

Docker at Cloud9 IDE
Docker at Cloud9 IDEDocker at Cloud9 IDE
Docker at Cloud9 IDElennartkats
 
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
 
Language Engineering in the Cloud
Language Engineering in the CloudLanguage Engineering in the Cloud
Language Engineering in the Cloudlennartkats
 
Test-driven language development
Test-driven language developmentTest-driven language development
Test-driven language developmentlennartkats
 
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...lennartkats
 
The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)lennartkats
 
Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)lennartkats
 
Providing Rapid Feedback in Generated Modular Language Environments (OOPSLA 2...
Providing Rapid Feedback in Generated Modular Language Environments (OOPSLA 2...Providing Rapid Feedback in Generated Modular Language Environments (OOPSLA 2...
Providing Rapid Feedback in Generated Modular Language Environments (OOPSLA 2...lennartkats
 
Decorated Attribute Grammars (CC 2009)
Decorated Attribute Grammars (CC 2009)Decorated Attribute Grammars (CC 2009)
Decorated Attribute Grammars (CC 2009)lennartkats
 
Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...
Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...
Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...lennartkats
 

Plus de lennartkats (10)

Docker at Cloud9 IDE
Docker at Cloud9 IDEDocker at Cloud9 IDE
Docker at Cloud9 IDE
 
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)
 
Language Engineering in the Cloud
Language Engineering in the CloudLanguage Engineering in the Cloud
Language Engineering in the Cloud
 
Test-driven language development
Test-driven language developmentTest-driven language development
Test-driven language development
 
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
 
The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)
 
Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)
 
Providing Rapid Feedback in Generated Modular Language Environments (OOPSLA 2...
Providing Rapid Feedback in Generated Modular Language Environments (OOPSLA 2...Providing Rapid Feedback in Generated Modular Language Environments (OOPSLA 2...
Providing Rapid Feedback in Generated Modular Language Environments (OOPSLA 2...
 
Decorated Attribute Grammars (CC 2009)
Decorated Attribute Grammars (CC 2009)Decorated Attribute Grammars (CC 2009)
Decorated Attribute Grammars (CC 2009)
 
Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...
Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...
Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...
 

Dernier

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Dernier (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

Domain-Specific Languages for Composable Editor Plugins (LDTA 2009)

  • 1. Domain-Specific Langua ges for Composable Editor Plugins LDTA 2009, York, UK Lennart Kats (me), Delft University of Technology Karl Trygve Kalleberg, University of Bergen Eelco Visser, Delft University of Technology March 19, 2009 Software Engineering Research Group
  • 2. The Framework is the Language
  • 3. The IDE is the Language
  • 4. Implementing IDEs: The Two Faces of Eclipse Eclipse platform: • Cross-platform, open-source • People have it • People use it • Java, ...
  • 5. Implementing IDEs: The Two Faces of Eclipse Huge, low-level API • SWT widgets • synchronization • I/O • regexes
  • 6. Implementing IDEs: The Two Faces of Eclipse Weakly typed interfaces • XML • java.lang.Object, IAdaptable • CoreException "A checked exception representing a failure."
  • 8. DSLs and Language Extensions Domain-specific void browse() { List<Book> books = • Database queries <| SELECT * • Regular expressions FROM books • XML processing WHERE price < 100.00 |>; • Matrices • Complex numbers … • ... for (int i = 0; i < books.size(); i++) books.get(i).title =~ s/^The //; }
  • 9. Meta-programming with Concrete Object Syntax • Program transformation • Stratego with WebDSL, Java, XML webdsl-action-to-java-method: |[ action x_action(farg*) { stat* } ]| -> |[ public void x_action(param*) { bstm* } ]| with param* := <map(action-arg-to-java)> farg*; bstm* := <statements-to-java> stat*
  • 11. IDE development environments (Or: How to Learn to Stop Worrying and Love Eclipse) • Abstraction • avoid Eclipse framework complexity • Modularity • separation of concerns • reuse • Extensibility and customization • integration with existing compilers, tools
  • 12. Introducing Spoofax/IMP • Three pillars: • SDF grammars • DSLs for service descriptors • Implemented using Spoofax and IMP frameworks (“SAFARI”)
  • 13. An IDE plugin created with Spoofax/IMP
  • 14. SDF and SGLR (1) • Unified lexical and context-free syntax module WebDSL imports MixHQL[HQL] AccessControl ... exports lexical syntax [a-zA-Z][a-zA-Z0-9_]* → Id ... context-free syntax "module" Id Section* → Unit {cons("Module")} "section" SectionName Def* → Section {cons("Section")} "define" Mod* Id "{" Element* "}" → Def {cons("SimpleDef")} ...
  • 15. SDF and SGLR (2) • Scannerless Generalized-LR Parsing • Full class of context-free grammars • Compositional • Declarative disambiguation filters module Stratego-WebDSL-Java-XML imports Stratego-Java-15 Stratego-WebDSL Stratego-XML
  • 16. Modular Editor Service Definitions • Main file • Definition for each service • Generated definitions
  • 17. Reuse and Modularity in IDE plugins Stratego + WebDSL editor = StrategoWebDSL editor • Declarative specifications • (Backdoor available)
  • 18. Creating a brand new IDE plugin Requires: Gives you: • Syntax definition • Service templates • Language name • Generated services • File extension(s) • plugin.xml, ... And: • Basic IDE functionality: Coloring, outline, folding
  • 19. In the Beginning: WebDSL.main.esv module WebDSL.main imports WebDSL-Analysis WebDSL-Colorer WebDSL-... language Description name : WebDSL aliases : WebDiesel id : org.strategoxt.imp.generated.webdsl description : "Spoofax/IMP-generated editor for the WebDSL language" url : http://strategoxt.org language Files and parsing [...]
  • 20. In the Beginning: WebDSL.main.esv module WebDSL.main imports WebDSL-Analysis WebDSL-... WebDSL-Colorer WebDSL-... language Description [...] language Files and parsing extensions [...] : app table : include/WebDSL.tbl start symbols : Unit
  • 21. In the Beginning (2): Generated Services • Based on heuristics • Rapid prototyping • Starting point • functioning as an example • self-documenting module WebDSL-Colorer.generated // ...documentation... colorer Default highlighting rules keyword : "Keywords" = magenta bold string : "Strings" = blue number : "Numbers" = darkgreen ...
  • 22. Example: The colorer service module Stratego-WebDSL-Colorer imports Stratego WebDSL colorer Variables _.Var : green italic colorer Concrete syntax environment _.ToMetaExpr: _ gray environment _.FromMetaExpr: _ white
  • 23. Example: The folding service module Java-Folding imports Java-Folding.generated folding Customization CompilationUnit NewInstance QNewInstance ImportDec* (folded) Block (disable)
  • 24. Syntactic Editor Services • Syntax errors • Code folding • Outline view • Brace matching • Comments • Source code formatting
  • 25. Semantic Editor Services • Error reporting • Reference resolving • Reference info • Occurrence highlighting
  • 26. Stratego integration Stratego: • Rewrite rules • Strategies to control their application • Used for e.g., WebDSL, Stratego, Java [OOPSLA'08]
  • 27. Interfacing with Stratego • Interface based on rewrite rules • Adapted primitives for parsing, caching Offending term + message tuples [(Var(“auhtor”), “undeclared”), ...] editor­analyze:   (ast, path, fullpath) ­> (errors, warnings, infos)   with     ...     (errors, warnings, infos) := <collect­all­markers> ast     ...
  • 28. Interfacing with Stratego • Interface based on rewrite rules • Adapted primitives for parsing, caching Referenced declaration Property(“author”, ...) reference­resolve:   (ast, path, fullpath, reference) ­> declaration   with     ...     declaration := <find­decl> reference     ...
  • 29. Using Stratego: A Global-to-Local Transformation entity User { username :: String (id) entity User { password :: Secret username :: String (id) isAdmin :: Bool password :: Secret } isAdmin :: Bool normalize name :: String manager -> User extend entity User { employees -> Set<User> name :: String } manager -> User employees -> Set<User> }
  • 30. Term Rewriting with Origin Tracking [Van Deursen et al 1993] entity User { username :: String (id) entity User { password :: Secret username :: String (id) isAdmin :: Bool password :: Secret } isAdmin :: Bool normalize name :: String manager -> User extend entity User { employees -> Set<User> name :: String } manager -> User employees -> Set<User> }
  • 31. Program Object Model (POM) adapter [Kalleberg et al, LDTA'07] Interpret term operations as API calls • Using Spoofax interpreter • Intercept applications of rewrite rules in strategies • Override term building, 'all', 'some', and 'one' for origin tracking
  • 33. Dynamic Building and Loading: The Editor Service Builder • Verifies all service descriptors • Syntax • Existing sorts • ... • Updates plugin.xml, etc. • Builds parse tables
  • 34. Dynamic Building and Loading: Dynamically Loading Editor Services <<language>> • IMP provides: DynamicRoot DynamicColor : Colorer • static, XML-based dynamicFolder : Folder editor declarations ... • language inheritance <<language>> WebDSL • Base language • Defines default services • May be overridden by dynamic or “backdoor” implementations
  • 35. Looking back LDTA'07: Spoofax Embedded Java code
  • 36. Looking back LDTA'08: sdf2imp No: • Semantic services • Dynamic loading • Modular definitions
  • 37. Looking forward (to) • Complete Stratego-based DSL environment • compiler for Java • SDF bundle • Expansion of editor services • e.g. content completion
  • 38. Looking forward (to) • Integration with Aster [CC 2009] • Better interactive parser • performance • error handling • content completion
  • 39. Concluding Remarks • Declarative DSLs • Avoid Eclipse API complexity • Specialized syntax • Compositionality • Co-evolution of language and IDE Domain­Specific Languages for Composable Editor Plugins. Lennart C. L. Kats, Karl T. Kalleberg, and Eelco Visser. LDTA 2009. http://www.strategoxt.org/Stratego/Spoofax­IMP