SlideShare a Scribd company logo
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

More Related Content

What's hot (20)

PPTX
Scoobi - Scala for Startups
bmlever
 
PPTX
Dartprogramming
Ali Parmaksiz
 
PDF
Advanced Php - Macq Electronique 2010
Michelangelo van Dam
 
PPTX
11. session 11 functions and objects
Phúc Đỗ
 
PDF
Scala DSLの作り方
Tomoharu ASAMI
 
PPTX
concurrency gpars
Paul King
 
PDF
Requery overview
Sunghyouk Bae
 
PDF
Kotlin @ Coupang Backend 2017
Sunghyouk Bae
 
PDF
Scalding for Hadoop
Chicago Hadoop Users Group
 
PDF
concurrency with GPars
Paul King
 
ODP
GPars (Groovy Parallel Systems)
Gagan Agrawal
 
PDF
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Sunghyouk Bae
 
PDF
Pragmatic Real-World Scala (short version)
Jonas Bonér
 
PPT
Spring data
명철 강
 
PDF
Dart
anandvns
 
PDF
The Xtext Grammar Language
Dr. Jan Köhnlein
 
KEY
Xtext Eclipse Con
Sven Efftinge
 
PDF
awesome groovy
Paul King
 
PDF
Alternatives of JPA/Hibernate
Sunghyouk Bae
 
Scoobi - Scala for Startups
bmlever
 
Dartprogramming
Ali Parmaksiz
 
Advanced Php - Macq Electronique 2010
Michelangelo van Dam
 
11. session 11 functions and objects
Phúc Đỗ
 
Scala DSLの作り方
Tomoharu ASAMI
 
concurrency gpars
Paul King
 
Requery overview
Sunghyouk Bae
 
Kotlin @ Coupang Backend 2017
Sunghyouk Bae
 
Scalding for Hadoop
Chicago Hadoop Users Group
 
concurrency with GPars
Paul King
 
GPars (Groovy Parallel Systems)
Gagan Agrawal
 
Kotlin @ Coupang Backed - JetBrains Day seoul 2018
Sunghyouk Bae
 
Pragmatic Real-World Scala (short version)
Jonas Bonér
 
Spring data
명철 강
 
Dart
anandvns
 
The Xtext Grammar Language
Dr. Jan Köhnlein
 
Xtext Eclipse Con
Sven Efftinge
 
awesome groovy
Paul King
 
Alternatives of JPA/Hibernate
Sunghyouk Bae
 

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

PDF
Building DSLs with the Spoofax Language Workbench
Eelco Visser
 
PDF
The Spoofax Language Workbench (SPLASH 2010)
lennartkats
 
PDF
Building DSLs with Xtext - Eclipse Modeling Day 2009
Heiko Behrens
 
PDF
Model-Driven Software Development - Language Workbenches & Syntax Definition
Eelco Visser
 
PDF
Overcoming The Impedance Mismatch Between Source Code And Architecture
Peter Friese
 
PDF
Going to Mars with Groovy Domain-Specific Languages
Guillaume Laforge
 
PDF
Uml2
Majong DevJfu
 
PDF
oAW Presentation
Saif Kamaal
 
PDF
Using Stratego/XT for generation of software connectors.
Michal Malohlava
 
PDF
Xtext Webinar
Sven Efftinge
 
PDF
PIL - A Platform Independent Language
zefhemel
 
PDF
Better DSL Support for Groovy-Eclipse
Andrew Eisenberg
 
PDF
GR8Conf 2011: STS DSL Support
GR8Conf
 
PDF
Xtext Webinar
Heiko Behrens
 
PPT
Syntactic Salt and Sugar Presentation
grepalex
 
PDF
Grammarware Memes
Eelco Visser
 
PDF
Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...
lennartkats
 
PDF
Groovy Domain Specific Languages - SpringOne2GX 2012
Guillaume Laforge
 
PDF
Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...
Chauvin Mariot
 
KEY
Clojure: a LISP for the JVM
Knowledge Engineering and Machine Learning Group
 
Building DSLs with the Spoofax Language Workbench
Eelco Visser
 
The Spoofax Language Workbench (SPLASH 2010)
lennartkats
 
Building DSLs with Xtext - Eclipse Modeling Day 2009
Heiko Behrens
 
Model-Driven Software Development - Language Workbenches & Syntax Definition
Eelco Visser
 
Overcoming The Impedance Mismatch Between Source Code And Architecture
Peter Friese
 
Going to Mars with Groovy Domain-Specific Languages
Guillaume Laforge
 
oAW Presentation
Saif Kamaal
 
Using Stratego/XT for generation of software connectors.
Michal Malohlava
 
Xtext Webinar
Sven Efftinge
 
PIL - A Platform Independent Language
zefhemel
 
Better DSL Support for Groovy-Eclipse
Andrew Eisenberg
 
GR8Conf 2011: STS DSL Support
GR8Conf
 
Xtext Webinar
Heiko Behrens
 
Syntactic Salt and Sugar Presentation
grepalex
 
Grammarware Memes
Eelco Visser
 
Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...
lennartkats
 
Groovy Domain Specific Languages - SpringOne2GX 2012
Guillaume Laforge
 
Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...
Chauvin Mariot
 
Ad

More from lennartkats (8)

PDF
Docker at Cloud9 IDE
lennartkats
 
KEY
Remix Your Language Tooling (JSConf.eu 2012)
lennartkats
 
KEY
Language Engineering in the Cloud
lennartkats
 
KEY
Test-driven language development
lennartkats
 
PDF
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
lennartkats
 
KEY
Using Aspects for Language Portability (SCAM 2010)
lennartkats
 
PDF
Providing Rapid Feedback in Generated Modular Language Environments (OOPSLA 2...
lennartkats
 
PDF
Decorated Attribute Grammars (CC 2009)
lennartkats
 
Docker at Cloud9 IDE
lennartkats
 
Remix Your Language Tooling (JSConf.eu 2012)
lennartkats
 
Language Engineering in the Cloud
lennartkats
 
Test-driven language development
lennartkats
 
Integrated Language Definition Testing: Enabling Test-Driven Language Develop...
lennartkats
 
Using Aspects for Language Portability (SCAM 2010)
lennartkats
 
Providing Rapid Feedback in Generated Modular Language Environments (OOPSLA 2...
lennartkats
 
Decorated Attribute Grammars (CC 2009)
lennartkats
 
Ad

Recently uploaded (20)

PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 

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