SlideShare une entreprise Scribd logo
1  sur  44
Télécharger pour lire hors ligne
Domain Specific Languages
      Two Types of Language Engineering
    Technologies for Language Engineering
             DSM-ing as Theory Building




                     An Overview of DSLs

                                   Tony Clark

School of Engineering and Information Sciences University of Middlesex


                            November 24, 2010




                             Tony Clark     An Overview of DSLs
Domain Specific Languages
             Two Types of Language Engineering
           Technologies for Language Engineering
                    DSM-ing as Theory Building


Outline

  1   Domain Specific Languages
        What are DSLs?
        An Example DSL
        A Word about Frameworks
        General Properties
  2   Two Types of Language Engineering
       λ − Calculus
       Modelling
  3   Technologies for Language Engineering
        The XMF Family
        Language Factories
  4   DSM-ing as Theory Building

                                    Tony Clark     An Overview of DSLs
Domain Specific Languages     What are DSLs?
          Two Types of Language Engineering     An Example DSL
        Technologies for Language Engineering   A Word about Frameworks
                 DSM-ing as Theory Building     General Properties


What Are Domain Specific Languages?




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages     What are DSLs?
            Two Types of Language Engineering     An Example DSL
          Technologies for Language Engineering   A Word about Frameworks
                   DSM-ing as Theory Building     General Properties


Types of Domain Specific Languages


     Internal A host language is extended with sub-languages that
              are used for a specific aspect of the application. The
              host language is the glue.
     External An application consists of modules for different
              aspects. Each module is written in a different
              language.
      Textual A programming language or a domain specific
              configuration file.
    Graphical Using icons and graphical layout to represent ’initial’
              elements.



                                   Tony Clark     An Overview of DSLs
Domain Specific Languages     What are DSLs?
          Two Types of Language Engineering     An Example DSL
        Technologies for Language Engineering   A Word about Frameworks
                 DSM-ing as Theory Building     General Properties


An Example DSL: Domain (due to Martin Fowler)




     SVCLFOWLER 10101MS0120050313
     SVCLHOHPE 10201DX0320050315
     SVCLTWO x10301MRP220050329
     USGE10301TWO x50214..7050329




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages     What are DSLs?
          Two Types of Language Engineering     An Example DSL
        Technologies for Language Engineering   A Word about Frameworks
                 DSM-ing as Theory Building     General Properties


An Example DSL: A Framework

     public void ConfigCallReader(Framework f) {
       f.registerStrategy(ConfigureServiceCall());
       f.registerStrategy(ConfigureUsage());
     }
     private ReaderStrategy ConfigureServiceCall() {
       ReaderStrategy r =
         new ReaderStrategy("SVCL",ServiceCall);
       r.addFieldExtractor(4,18,"CustomerName"));
       r.addFieldExtractor(19,23,"CustomerID"));
       r.addFieldExtractor(24,27,"CalltypeCode"));
       r.addFieldExtractor(28,35,"DataOfCallString"));
       return r;
     }


                                 Tony Clark     An Overview of DSLs
Domain Specific Languages     What are DSLs?
          Two Types of Language Engineering     An Example DSL
        Technologies for Language Engineering   A Word about Frameworks
                 DSM-ing as Theory Building     General Properties


An Example DSL: Language To Configure the Framework
     @Reader CallReader
       map(SVCL,ServiceCall)
         4-18:CustomerName
         19-23:CustomerID
         24-27:CallTypeCode
         28-35:DataOfCallString
       end
       map(USGE,Usage)
         4-8:CustomerID
         9-22:CustomerName
         30-30:Cycle
         31-36:ReadDate
       end
       do
         ServiceCall
         Usage
     end
                                 Tony Clark     An Overview of DSLs
Domain Specific Languages     What are DSLs?
           Two Types of Language Engineering     An Example DSL
         Technologies for Language Engineering   A Word about Frameworks
                  DSM-ing as Theory Building     General Properties


Frameworks: Inversion of Control




                                  Tony Clark     An Overview of DSLs
Domain Specific Languages     What are DSLs?
               Two Types of Language Engineering     An Example DSL
             Technologies for Language Engineering   A Word about Frameworks
                      DSM-ing as Theory Building     General Properties


Benefits and Drawbacks

  Benefits:
      Speed of application development.
      Domain specific tools: quality.
      Ease of maintenance.

  Drawbacks:
      DSL development effort.
      Lack of tool support.
      DSL development expertise.
      DSL maintenence expertise.


                                      Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     λ − Calculus
        Technologies for Language Engineering   Modelling
                 DSM-ing as Theory Building


λ − Calculus: A Terminal Candidate




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering     λ − Calculus
         Technologies for Language Engineering   Modelling
                  DSM-ing as Theory Building


λ − Calculus Definition




     E ::= V                       variables
       |   fun(V) E                functions
       |   E E                     applications




                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     λ − Calculus
        Technologies for Language Engineering   Modelling
                 DSM-ing as Theory Building


Simple DSL



     class Circle(x,y,r) {
       meth xin(x’) { ret [x-r,x+r].contains(x’); }
       meth yin(y’) { ret [y-r,y+r].contains(y’); }
       meth in(x’,y’) { ret self.xin(x’) & self.yin(y’); }
     }
     class Doughnut(x,y,r,r’) extends Circle {
       var c = new Circle(x,y,r’);
       meth xin(x’) { ret super.xin(x’) & !c.xin(x’); }
       meth yin(y’) { ret super.yin(y’) & !c.yin(y’); }
     }




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     λ − Calculus
        Technologies for Language Engineering   Modelling
                 DSM-ing as Theory Building


What Do Run-Time Values Look Like?




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering     λ − Calculus
         Technologies for Language Engineering   Modelling
                  DSM-ing as Theory Building


λ − Calculus Extensions: Definitions




      E ::=   V                        variables
        |     fun(V) E                 functions
        |     E E                      applications
        |     let D                    top-level definitions
      D ::=   V = E                    value definitions
        |     V(V) = E                 function definitions




                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering     λ − Calculus
         Technologies for Language Engineering   Modelling
                  DSM-ing as Theory Building


Translation: Class Definitions



      class Circle(x,y,r) { ... }
      class Doughnut(x,y,r,r’) ... { ... }




      let Circle(x,y,r) = fun(self) ...
      let Doughnut(x,y,r,r’) = fun(self) ...




                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering     λ − Calculus
         Technologies for Language Engineering   Modelling
                  DSM-ing as Theory Building


λ − Calculus Extensions: Records


      E ::=   V                        variables
        |     fun(V) E                 functions
        |     E E                      applications
        |     let D                    top-level definitions
        |     let D in E               local definitions
        |     { D* }                   records
        |     E + E                    addition (overloaded)
        |     E.V                      field ref
      D ::=   V = E                    value definitions
        |     V(V) = E                 function definitions




                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering     λ − Calculus
         Technologies for Language Engineering   Modelling
                  DSM-ing as Theory Building


Translation: Class Bodies


      let Circle(x,y,r) = fun(self) {
        xin(x’) = ...;
        yin(y’) = ...;
        in(x’,y’) = ...
      }
      let Doughnut(x,y,r,r’) = fun(self)
        let super = Circle(x,y,r)(self)
        in let c = ...
           in super + {
             xin(x’) = ...
             yin(y’) = ...
           }



                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering     λ − Calculus
         Technologies for Language Engineering   Modelling
                  DSM-ing as Theory Building


λ − Calculus Extensions: Recursion


      E ::=   V                        variables
        |     fun(V) E                 functions
        |     E E                      applications
        |     let D                    top-level definitions
        |     let D in E               local definitions
        |     { D* }                   records
        |     E + E                    addition (overloaded)
        |     E.V                      field ref
        |     Y E                      fixed point: (Y(E))(E’) = E’
      D ::=   V = E                    value definitions
        |     V(V) = E                 function definitions




                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     λ − Calculus
        Technologies for Language Engineering   Modelling
                 DSM-ing as Theory Building


Translation: Method Bodies


     let Circle(x,y,r) = fun(self) {
       xin(x’) = [x-r,r+x].contains(x’);
       yin(y’) = [y-r,r+y].contains(y’);
       in(x’,y’) = (self.xin)(x’) & (self.yin)(y’)
     }
     let Doughnut(x,y,r,’) = fun(self)
       let super = Circle(x,y,r)(self)
       in let c = Y(Circle(x,y,r’))
          in super + {
            xin(x’) = (super.xin)(x’) & !c.xin(x’)
            yin(y’) = (super.yin)(y’) & !c.yin(y’)
          }



                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
            Two Types of Language Engineering     λ − Calculus
          Technologies for Language Engineering   Modelling
                   DSM-ing as Theory Building


λ-calculus: Conclusion


      Design a domain specific language (e.g. classes, methods etc)
      Translate it onto the basic λ-calculus.
      Invent:
          syntax extensions for λ (e.g. records, definitions, Y).
          evaluation extensions for λ (not shown, but SECD is a good
          place to start).
      Each to implement directly or use a blueprint for translation.
      To start: write an interpreter for λ and extend it.




                                   Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     λ − Calculus
        Technologies for Language Engineering   Modelling
                 DSM-ing as Theory Building


Objects: A Terminal Candidate




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     λ − Calculus
        Technologies for Language Engineering   Modelling
                 DSM-ing as Theory Building


Modelling Languages




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     λ − Calculus
        Technologies for Language Engineering   Modelling
                 DSM-ing as Theory Building


A Simple Modelling Language: Abstract Syntax




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     λ − Calculus
        Technologies for Language Engineering   Modelling
                 DSM-ing as Theory Building


A Simple Modelling Language: Semantic Domain




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     λ − Calculus
        Technologies for Language Engineering   Modelling
                 DSM-ing as Theory Building


A Simple Modelling Language: Concrete Syntax




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     λ − Calculus
        Technologies for Language Engineering   Modelling
                 DSM-ing as Theory Building


Semantic Mapping




     context Class inv instance_has_all_slots:
      attributes.name = instances.slots.name
     context Class inv instance_satisfies_constraints:
      constraints->forAll(c |
       instances->forAll(o | c.satisfiedBy(o)))
     context Class inv instances_conform_to_super:
      parents->forAll(c |
       c.instances->includesAll(instances))
     context Object inv slot_values_are_type_correct:
      slots->forAll(s |
       s.value oclIsTypeOf(Object) implies
        s.value.type.instance->includes(s.value)

                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     λ − Calculus
        Technologies for Language Engineering   Modelling
                 DSM-ing as Theory Building


Syntax Mapping




     context Class inv display_name:
       classBox.className.text.text = name
     context ClassBox inv name_at_top:
       className.x = x and
       className.y = y and
       className.width = width
     context ClassName min_height:
       height >= text.getHeight()
                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering     λ − Calculus
         Technologies for Language Engineering   Modelling
                  DSM-ing as Theory Building


A Language Extension: Default Instances




     context ClassWithDefault inv default_is_instance:
       instances->includes(default)
     context ClassWithDefault inv default_well_formed:
       slotDescriptor.name->subSet(default.slots.name)
     context ClassWithDefault inv defaul_slots_OK:
       slotDescriptor->forAll(d |
         default.slots->exists(s |
           s.name = d.name and s.value = d.value))
                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering     λ − Calculus
         Technologies for Language Engineering   Modelling
                  DSM-ing as Theory Building


Object Modelling: Conclusion



     Design a language in terms of models for abstract syntax,
     concrete syntax amd semantic domain.
     Define mappings between them.
     Know about:
         class-models (modelling languages often extend this).
         object-models (a universal semantic domain).




                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
            Two Types of Language Engineering     The XMF Family
          Technologies for Language Engineering   Language Factories
                   DSM-ing as Theory Building


XMF


 XMF language definition features:
      Reflexive: Meta-Obejct Protocol (MOP)
      Language definition features: internal and external languages.
      Access to abstract syntax.
      Libraries for language processing.
 XMF-Mosaic:
      Modelling IDE built using XMF.
      Graphical languages modelled using meta-models.
      Tool Models.



                                   Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     The XMF Family
        Technologies for Language Engineering   Language Factories
                 DSM-ing as Theory Building


XMF Example: State Machine Syntax Class
     @Class StateMachine
      @Grammar extends OCL.grammar
       StateMachine ::= ’(’ n=Name ’)’ es=Exp* {
        [| StateMachine(<n>,<es>) |] }.
      end
     end
     @Class Transition
      @Grammar extends OCL.grammar
       Transition ::= ’(’ sn=Name ’,’ tn=Name ’)’ {
        [| Transition(<sn>,<tn>) |] }.
      end
     end
     @Class State
      @Grammar extends OCL.grammar
       State ::= n=Name { [| State(<n>) |] }.
      end
     end
                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     The XMF Family
        Technologies for Language Engineering   Language Factories
                 DSM-ing as Theory Building


XMF Example: State Machine Use


     @Class StateMachineGenerator
       @Attribute counter:Integer end
       @Operation mkStateMachine()
         self.counter := counter + 1;
         @StateMachine(Off)
           @State Off end
           @State On end
           @Transition(On,Off) end
           @Transition(Off,On) end
         end
       end
     end



                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering     The XMF Family
         Technologies for Language Engineering   Language Factories
                  DSM-ing as Theory Building


Language Factories

     A component-based approach to the definition and
     construction of languages, tools.
     Language Factories aim to support:
         Reuse of common language components.
         Agile language engineering.
         Language refactoring.
         Language analysis including impact analysis.
     Product Lines for Languages
     Users:
         Language Factory Developers
         Language Factory Users
         Application Developers
         Application Users

                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     The XMF Family
        Technologies for Language Engineering   Language Factories
                 DSM-ing as Theory Building


A Language Factory




     lang:
       ast: ...
       grammar: ...
       semantics eval(env): ...
       semantics java: ...
       constraints: ...




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     The XMF Family
        Technologies for Language Engineering   Language Factories
                 DSM-ing as Theory Building


Example Language


     component Landing_gear(height:int, speed:float) {
       stm {
         state Moving_Up
         state Moving_Down
         state Deployed
         state Stowed
         transition up from Deployed to Moving_Up
           height_change[height>500ft and speed>100kn/s]
         transition down from Stowed to Moving_Down
           deploy
       }
     }



                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering     The XMF Family
         Technologies for Language Engineering   Language Factories
                  DSM-ing as Theory Building


XPL: A Calculus for DSL Analysis



     E ::=   V                               variables
       |     fun(V) E                        functions
       |     E E                             applications
       |     { R* }                          grammars
       |     intern E { S }                  language use
     R ::=   ...                             syntax synthesizers
     S ::=   ...                             strings




                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering     The XMF Family
        Technologies for Language Engineering   Language Factories
                 DSM-ing as Theory Building


Other Technologies



     UML and Profiles
     EMF, GMF
     XText
     Converge
     MetaEdit+
     View based language environments.




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering     The XMF Family
         Technologies for Language Engineering   Language Factories
                  DSM-ing as Theory Building


Research Problems



     Modularity and reuse.
     Text-based systems and parsing.
     Type systems.
     Tooling and complexity.
     Interoperability.
     Code generation vs models at run-time.




                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering
         Technologies for Language Engineering
                  DSM-ing as Theory Building


Peter Naur: Programming as Theory Building

     Naur’s Thesis:

     Programmers design theories then map them to
     implementations.
     Theories allow questions to be asked (wider scope than a run).
     The theories are the things that capture the domain.
     Don’t change the program directly, change the theory and
     calculate the impact.
     Actually multiple theories for different viewpoints.
     The initial theory is unattainable, but can be incrementally
     approximated.


                                  Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering
        Technologies for Language Engineering
                 DSM-ing as Theory Building


DSM-ing as Theory Building




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering
        Technologies for Language Engineering
                 DSM-ing as Theory Building


DSL Architecture




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering
        Technologies for Language Engineering
                 DSM-ing as Theory Building


Theory Modelling




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
          Two Types of Language Engineering
        Technologies for Language Engineering
                 DSM-ing as Theory Building


Example: Influencing Models




                                 Tony Clark     An Overview of DSLs
Domain Specific Languages
           Two Types of Language Engineering
         Technologies for Language Engineering
                  DSM-ing as Theory Building


Conclusion

     Domain Specific activities are about theory building and
     theory transformation.
     To be effective you need to know your terminal theory well.
     Terminal theories known to be effective (and universal):
          λ-calculus
          object models.
     Other, less universal, targets are just as effective (e.g. Java).
     Practical issues:
          really translate (code generation)
          simulate the transformation (interpret the model)
     General problems:
          tools to support the process.
          up-front resource and expertise.
                                  Tony Clark     An Overview of DSLs

Contenu connexe

Tendances

Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3
Akshay Nagpurkar
 
Object oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharpObject oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharp
Abefo
 

Tendances (10)

Programming for Problem Solving
Programming for Problem SolvingProgramming for Problem Solving
Programming for Problem Solving
 
Encoding Object-oriented Datatypes in HOL: Extensible Records Revisited
Encoding Object-oriented Datatypes in HOL: Extensible Records RevisitedEncoding Object-oriented Datatypes in HOL: Extensible Records Revisited
Encoding Object-oriented Datatypes in HOL: Extensible Records Revisited
 
Mathematical Semantic Markup in a Wiki: the Roles of Symbols and Notations
Mathematical Semantic Markup in a Wiki: the Roles of Symbols and NotationsMathematical Semantic Markup in a Wiki: the Roles of Symbols and Notations
Mathematical Semantic Markup in a Wiki: the Roles of Symbols and Notations
 
R programming presentation
R programming presentationR programming presentation
R programming presentation
 
C++ language
C++ languageC++ language
C++ language
 
Lecture 06
Lecture 06Lecture 06
Lecture 06
 
Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3Ppl for students unit 1,2 and 3
Ppl for students unit 1,2 and 3
 
Object oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharpObject oriented-programming-in-c-sharp
Object oriented-programming-in-c-sharp
 
Creating a textual domain specific language
Creating a textual domain specific languageCreating a textual domain specific language
Creating a textual domain specific language
 
Compiler question bank
Compiler question bankCompiler question bank
Compiler question bank
 

En vedette

Dsl tutorial
Dsl tutorialDsl tutorial
Dsl tutorial
ClarkTony
 
Leap isec 2011
Leap isec 2011Leap isec 2011
Leap isec 2011
ClarkTony
 
Kiss at oopsla 09
Kiss at oopsla 09Kiss at oopsla 09
Kiss at oopsla 09
ClarkTony
 
Patterns 200711
Patterns 200711Patterns 200711
Patterns 200711
ClarkTony
 

En vedette (6)

Dsl tutorial
Dsl tutorialDsl tutorial
Dsl tutorial
 
Leap isec 2011
Leap isec 2011Leap isec 2011
Leap isec 2011
 
Kiss at oopsla 09
Kiss at oopsla 09Kiss at oopsla 09
Kiss at oopsla 09
 
Hcse pres
Hcse presHcse pres
Hcse pres
 
Ast 09
Ast 09Ast 09
Ast 09
 
Patterns 200711
Patterns 200711Patterns 200711
Patterns 200711
 

Similaire à Dsl overview

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
 
Making Your Own Domain Specific Language
Making Your Own Domain Specific LanguageMaking Your Own Domain Specific Language
Making Your Own Domain Specific Language
Ancestry.com
 
sTeX+ – a System for Flexible Formalization of Linked Data
sTeX+ – a System for Flexible Formalization of Linked DatasTeX+ – a System for Flexible Formalization of Linked Data
sTeX+ – a System for Flexible Formalization of Linked Data
Christoph Lange
 
Generative Programming from a DSL Viewpoint
Generative Programming froma DSL ViewpointGenerative Programming froma DSL Viewpoint
Generative Programming from a DSL Viewpoint
elliando dias
 
AestasIT - Internal DSLs in Scala
AestasIT - Internal DSLs in ScalaAestasIT - Internal DSLs in Scala
AestasIT - Internal DSLs in Scala
Dmitry Buzdin
 
Domain-Specific Software Engineering
Domain-Specific Software EngineeringDomain-Specific Software Engineering
Domain-Specific Software Engineering
elliando dias
 

Similaire à Dsl overview (20)

Scam 08
Scam 08Scam 08
Scam 08
 
Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#
 
Architecting Domain-Specific Languages
Architecting Domain-Specific LanguagesArchitecting Domain-Specific Languages
Architecting Domain-Specific Languages
 
Introduction To MDD
Introduction To MDDIntroduction To MDD
Introduction To MDD
 
Vitalii Braslavskyi - Declarative engineering
Vitalii Braslavskyi - Declarative engineering Vitalii Braslavskyi - Declarative engineering
Vitalii Braslavskyi - Declarative engineering
 
Vitalii Braslavskyi "Declarative engineering"
Vitalii Braslavskyi "Declarative engineering"Vitalii Braslavskyi "Declarative engineering"
Vitalii Braslavskyi "Declarative engineering"
 
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)
 
DSL explained _
DSL explained _DSL explained _
DSL explained _
 
ITU - MDD - Textural Languages and Grammars
ITU - MDD - Textural Languages and GrammarsITU - MDD - Textural Languages and Grammars
ITU - MDD - Textural Languages and Grammars
 
Making Your Own Domain Specific Language
Making Your Own Domain Specific LanguageMaking Your Own Domain Specific Language
Making Your Own Domain Specific Language
 
Metamorphic Domain-Specific Languages
Metamorphic Domain-Specific LanguagesMetamorphic Domain-Specific Languages
Metamorphic Domain-Specific Languages
 
sTeX+ – a System for Flexible Formalization of Linked Data
sTeX+ – a System for Flexible Formalization of Linked DatasTeX+ – a System for Flexible Formalization of Linked Data
sTeX+ – a System for Flexible Formalization of Linked Data
 
Domain Specific Languages
Domain Specific LanguagesDomain Specific Languages
Domain Specific Languages
 
Generative Programming from a DSL Viewpoint
Generative Programming froma DSL ViewpointGenerative Programming froma DSL Viewpoint
Generative Programming from a DSL Viewpoint
 
Reverse-Engineering Reusable Language Modules from Legacy DSLs
Reverse-Engineering Reusable Language Modules from Legacy DSLsReverse-Engineering Reusable Language Modules from Legacy DSLs
Reverse-Engineering Reusable Language Modules from Legacy DSLs
 
AestasIT - Internal DSLs in Scala
AestasIT - Internal DSLs in ScalaAestasIT - Internal DSLs in Scala
AestasIT - Internal DSLs in Scala
 
keynote modelsward 2017
keynote modelsward 2017keynote modelsward 2017
keynote modelsward 2017
 
Domain-Specific Software Engineering
Domain-Specific Software EngineeringDomain-Specific Software Engineering
Domain-Specific Software Engineering
 
Global DSL workshop slides
Global DSL workshop slidesGlobal DSL workshop slides
Global DSL workshop slides
 
Interacting Domain Specific Languages
Interacting Domain Specific LanguagesInteracting Domain Specific Languages
Interacting Domain Specific Languages
 

Plus de ClarkTony

Context-Aware Content-Centric Collaborative Workflow Management for Mobile De...
Context-Aware Content-Centric Collaborative Workflow Management for Mobile De...Context-Aware Content-Centric Collaborative Workflow Management for Mobile De...
Context-Aware Content-Centric Collaborative Workflow Management for Mobile De...
ClarkTony
 
LEAP A Language for Architecture Design, Simulation and Analysis
LEAP A Language for Architecture Design, Simulation and AnalysisLEAP A Language for Architecture Design, Simulation and Analysis
LEAP A Language for Architecture Design, Simulation and Analysis
ClarkTony
 
A Common Basis for Modelling Service-Oriented and Event-Driven Architecture
A Common Basis for Modelling Service-Oriented and Event-Driven ArchitectureA Common Basis for Modelling Service-Oriented and Event-Driven Architecture
A Common Basis for Modelling Service-Oriented and Event-Driven Architecture
ClarkTony
 
Context Aware Reactive Applications
Context Aware Reactive ApplicationsContext Aware Reactive Applications
Context Aware Reactive Applications
ClarkTony
 
Model Slicing
Model SlicingModel Slicing
Model Slicing
ClarkTony
 
Kings 120711
Kings 120711Kings 120711
Kings 120711
ClarkTony
 
Iswim for testing
Iswim for testingIswim for testing
Iswim for testing
ClarkTony
 
Iswim for testing
Iswim for testingIswim for testing
Iswim for testing
ClarkTony
 
Mcms and ids sig
Mcms and ids sigMcms and ids sig
Mcms and ids sig
ClarkTony
 
Reverse engineering and theory building v3
Reverse engineering and theory building v3Reverse engineering and theory building v3
Reverse engineering and theory building v3
ClarkTony
 
Onward presentation.en
Onward presentation.enOnward presentation.en
Onward presentation.en
ClarkTony
 
Formalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsFormalizing homogeneous language embeddings
Formalizing homogeneous language embeddings
ClarkTony
 
Filmstrip testing
Filmstrip testingFilmstrip testing
Filmstrip testing
ClarkTony
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory building
ClarkTony
 
Code gen 09 kiss results
Code gen 09   kiss resultsCode gen 09   kiss results
Code gen 09 kiss results
ClarkTony
 
Iswim for testing
Iswim for testingIswim for testing
Iswim for testing
ClarkTony
 

Plus de ClarkTony (20)

The Uncertain Enterprise
The Uncertain EnterpriseThe Uncertain Enterprise
The Uncertain Enterprise
 
Actors for Behavioural Simulation
Actors for Behavioural SimulationActors for Behavioural Simulation
Actors for Behavioural Simulation
 
Context-Aware Content-Centric Collaborative Workflow Management for Mobile De...
Context-Aware Content-Centric Collaborative Workflow Management for Mobile De...Context-Aware Content-Centric Collaborative Workflow Management for Mobile De...
Context-Aware Content-Centric Collaborative Workflow Management for Mobile De...
 
LEAP A Language for Architecture Design, Simulation and Analysis
LEAP A Language for Architecture Design, Simulation and AnalysisLEAP A Language for Architecture Design, Simulation and Analysis
LEAP A Language for Architecture Design, Simulation and Analysis
 
A Common Basis for Modelling Service-Oriented and Event-Driven Architecture
A Common Basis for Modelling Service-Oriented and Event-Driven ArchitectureA Common Basis for Modelling Service-Oriented and Event-Driven Architecture
A Common Basis for Modelling Service-Oriented and Event-Driven Architecture
 
Context Aware Reactive Applications
Context Aware Reactive ApplicationsContext Aware Reactive Applications
Context Aware Reactive Applications
 
Model Slicing
Model SlicingModel Slicing
Model Slicing
 
Kings 120711
Kings 120711Kings 120711
Kings 120711
 
Iswim for testing
Iswim for testingIswim for testing
Iswim for testing
 
Iswim for testing
Iswim for testingIswim for testing
Iswim for testing
 
Mcms and ids sig
Mcms and ids sigMcms and ids sig
Mcms and ids sig
 
Ocl 09
Ocl 09Ocl 09
Ocl 09
 
Reverse engineering and theory building v3
Reverse engineering and theory building v3Reverse engineering and theory building v3
Reverse engineering and theory building v3
 
Onward presentation.en
Onward presentation.enOnward presentation.en
Onward presentation.en
 
Formalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsFormalizing homogeneous language embeddings
Formalizing homogeneous language embeddings
 
Filmstrip testing
Filmstrip testingFilmstrip testing
Filmstrip testing
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory building
 
Code gen 09 kiss results
Code gen 09   kiss resultsCode gen 09   kiss results
Code gen 09 kiss results
 
Cg 2011
Cg 2011Cg 2011
Cg 2011
 
Iswim for testing
Iswim for testingIswim for testing
Iswim for testing
 

Dernier

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
Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
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
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Dsl overview

  • 1. Domain Specific Languages Two Types of Language Engineering Technologies for Language Engineering DSM-ing as Theory Building An Overview of DSLs Tony Clark School of Engineering and Information Sciences University of Middlesex November 24, 2010 Tony Clark An Overview of DSLs
  • 2. Domain Specific Languages Two Types of Language Engineering Technologies for Language Engineering DSM-ing as Theory Building Outline 1 Domain Specific Languages What are DSLs? An Example DSL A Word about Frameworks General Properties 2 Two Types of Language Engineering λ − Calculus Modelling 3 Technologies for Language Engineering The XMF Family Language Factories 4 DSM-ing as Theory Building Tony Clark An Overview of DSLs
  • 3. Domain Specific Languages What are DSLs? Two Types of Language Engineering An Example DSL Technologies for Language Engineering A Word about Frameworks DSM-ing as Theory Building General Properties What Are Domain Specific Languages? Tony Clark An Overview of DSLs
  • 4. Domain Specific Languages What are DSLs? Two Types of Language Engineering An Example DSL Technologies for Language Engineering A Word about Frameworks DSM-ing as Theory Building General Properties Types of Domain Specific Languages Internal A host language is extended with sub-languages that are used for a specific aspect of the application. The host language is the glue. External An application consists of modules for different aspects. Each module is written in a different language. Textual A programming language or a domain specific configuration file. Graphical Using icons and graphical layout to represent ’initial’ elements. Tony Clark An Overview of DSLs
  • 5. Domain Specific Languages What are DSLs? Two Types of Language Engineering An Example DSL Technologies for Language Engineering A Word about Frameworks DSM-ing as Theory Building General Properties An Example DSL: Domain (due to Martin Fowler) SVCLFOWLER 10101MS0120050313 SVCLHOHPE 10201DX0320050315 SVCLTWO x10301MRP220050329 USGE10301TWO x50214..7050329 Tony Clark An Overview of DSLs
  • 6. Domain Specific Languages What are DSLs? Two Types of Language Engineering An Example DSL Technologies for Language Engineering A Word about Frameworks DSM-ing as Theory Building General Properties An Example DSL: A Framework public void ConfigCallReader(Framework f) { f.registerStrategy(ConfigureServiceCall()); f.registerStrategy(ConfigureUsage()); } private ReaderStrategy ConfigureServiceCall() { ReaderStrategy r = new ReaderStrategy("SVCL",ServiceCall); r.addFieldExtractor(4,18,"CustomerName")); r.addFieldExtractor(19,23,"CustomerID")); r.addFieldExtractor(24,27,"CalltypeCode")); r.addFieldExtractor(28,35,"DataOfCallString")); return r; } Tony Clark An Overview of DSLs
  • 7. Domain Specific Languages What are DSLs? Two Types of Language Engineering An Example DSL Technologies for Language Engineering A Word about Frameworks DSM-ing as Theory Building General Properties An Example DSL: Language To Configure the Framework @Reader CallReader map(SVCL,ServiceCall) 4-18:CustomerName 19-23:CustomerID 24-27:CallTypeCode 28-35:DataOfCallString end map(USGE,Usage) 4-8:CustomerID 9-22:CustomerName 30-30:Cycle 31-36:ReadDate end do ServiceCall Usage end Tony Clark An Overview of DSLs
  • 8. Domain Specific Languages What are DSLs? Two Types of Language Engineering An Example DSL Technologies for Language Engineering A Word about Frameworks DSM-ing as Theory Building General Properties Frameworks: Inversion of Control Tony Clark An Overview of DSLs
  • 9. Domain Specific Languages What are DSLs? Two Types of Language Engineering An Example DSL Technologies for Language Engineering A Word about Frameworks DSM-ing as Theory Building General Properties Benefits and Drawbacks Benefits: Speed of application development. Domain specific tools: quality. Ease of maintenance. Drawbacks: DSL development effort. Lack of tool support. DSL development expertise. DSL maintenence expertise. Tony Clark An Overview of DSLs
  • 10. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building λ − Calculus: A Terminal Candidate Tony Clark An Overview of DSLs
  • 11. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building λ − Calculus Definition E ::= V variables | fun(V) E functions | E E applications Tony Clark An Overview of DSLs
  • 12. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building Simple DSL class Circle(x,y,r) { meth xin(x’) { ret [x-r,x+r].contains(x’); } meth yin(y’) { ret [y-r,y+r].contains(y’); } meth in(x’,y’) { ret self.xin(x’) & self.yin(y’); } } class Doughnut(x,y,r,r’) extends Circle { var c = new Circle(x,y,r’); meth xin(x’) { ret super.xin(x’) & !c.xin(x’); } meth yin(y’) { ret super.yin(y’) & !c.yin(y’); } } Tony Clark An Overview of DSLs
  • 13. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building What Do Run-Time Values Look Like? Tony Clark An Overview of DSLs
  • 14. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building λ − Calculus Extensions: Definitions E ::= V variables | fun(V) E functions | E E applications | let D top-level definitions D ::= V = E value definitions | V(V) = E function definitions Tony Clark An Overview of DSLs
  • 15. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building Translation: Class Definitions class Circle(x,y,r) { ... } class Doughnut(x,y,r,r’) ... { ... } let Circle(x,y,r) = fun(self) ... let Doughnut(x,y,r,r’) = fun(self) ... Tony Clark An Overview of DSLs
  • 16. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building λ − Calculus Extensions: Records E ::= V variables | fun(V) E functions | E E applications | let D top-level definitions | let D in E local definitions | { D* } records | E + E addition (overloaded) | E.V field ref D ::= V = E value definitions | V(V) = E function definitions Tony Clark An Overview of DSLs
  • 17. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building Translation: Class Bodies let Circle(x,y,r) = fun(self) { xin(x’) = ...; yin(y’) = ...; in(x’,y’) = ... } let Doughnut(x,y,r,r’) = fun(self) let super = Circle(x,y,r)(self) in let c = ... in super + { xin(x’) = ... yin(y’) = ... } Tony Clark An Overview of DSLs
  • 18. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building λ − Calculus Extensions: Recursion E ::= V variables | fun(V) E functions | E E applications | let D top-level definitions | let D in E local definitions | { D* } records | E + E addition (overloaded) | E.V field ref | Y E fixed point: (Y(E))(E’) = E’ D ::= V = E value definitions | V(V) = E function definitions Tony Clark An Overview of DSLs
  • 19. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building Translation: Method Bodies let Circle(x,y,r) = fun(self) { xin(x’) = [x-r,r+x].contains(x’); yin(y’) = [y-r,r+y].contains(y’); in(x’,y’) = (self.xin)(x’) & (self.yin)(y’) } let Doughnut(x,y,r,’) = fun(self) let super = Circle(x,y,r)(self) in let c = Y(Circle(x,y,r’)) in super + { xin(x’) = (super.xin)(x’) & !c.xin(x’) yin(y’) = (super.yin)(y’) & !c.yin(y’) } Tony Clark An Overview of DSLs
  • 20. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building λ-calculus: Conclusion Design a domain specific language (e.g. classes, methods etc) Translate it onto the basic λ-calculus. Invent: syntax extensions for λ (e.g. records, definitions, Y). evaluation extensions for λ (not shown, but SECD is a good place to start). Each to implement directly or use a blueprint for translation. To start: write an interpreter for λ and extend it. Tony Clark An Overview of DSLs
  • 21. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building Objects: A Terminal Candidate Tony Clark An Overview of DSLs
  • 22. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building Modelling Languages Tony Clark An Overview of DSLs
  • 23. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building A Simple Modelling Language: Abstract Syntax Tony Clark An Overview of DSLs
  • 24. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building A Simple Modelling Language: Semantic Domain Tony Clark An Overview of DSLs
  • 25. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building A Simple Modelling Language: Concrete Syntax Tony Clark An Overview of DSLs
  • 26. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building Semantic Mapping context Class inv instance_has_all_slots: attributes.name = instances.slots.name context Class inv instance_satisfies_constraints: constraints->forAll(c | instances->forAll(o | c.satisfiedBy(o))) context Class inv instances_conform_to_super: parents->forAll(c | c.instances->includesAll(instances)) context Object inv slot_values_are_type_correct: slots->forAll(s | s.value oclIsTypeOf(Object) implies s.value.type.instance->includes(s.value) Tony Clark An Overview of DSLs
  • 27. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building Syntax Mapping context Class inv display_name: classBox.className.text.text = name context ClassBox inv name_at_top: className.x = x and className.y = y and className.width = width context ClassName min_height: height >= text.getHeight() Tony Clark An Overview of DSLs
  • 28. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building A Language Extension: Default Instances context ClassWithDefault inv default_is_instance: instances->includes(default) context ClassWithDefault inv default_well_formed: slotDescriptor.name->subSet(default.slots.name) context ClassWithDefault inv defaul_slots_OK: slotDescriptor->forAll(d | default.slots->exists(s | s.name = d.name and s.value = d.value)) Tony Clark An Overview of DSLs
  • 29. Domain Specific Languages Two Types of Language Engineering λ − Calculus Technologies for Language Engineering Modelling DSM-ing as Theory Building Object Modelling: Conclusion Design a language in terms of models for abstract syntax, concrete syntax amd semantic domain. Define mappings between them. Know about: class-models (modelling languages often extend this). object-models (a universal semantic domain). Tony Clark An Overview of DSLs
  • 30. Domain Specific Languages Two Types of Language Engineering The XMF Family Technologies for Language Engineering Language Factories DSM-ing as Theory Building XMF XMF language definition features: Reflexive: Meta-Obejct Protocol (MOP) Language definition features: internal and external languages. Access to abstract syntax. Libraries for language processing. XMF-Mosaic: Modelling IDE built using XMF. Graphical languages modelled using meta-models. Tool Models. Tony Clark An Overview of DSLs
  • 31. Domain Specific Languages Two Types of Language Engineering The XMF Family Technologies for Language Engineering Language Factories DSM-ing as Theory Building XMF Example: State Machine Syntax Class @Class StateMachine @Grammar extends OCL.grammar StateMachine ::= ’(’ n=Name ’)’ es=Exp* { [| StateMachine(<n>,<es>) |] }. end end @Class Transition @Grammar extends OCL.grammar Transition ::= ’(’ sn=Name ’,’ tn=Name ’)’ { [| Transition(<sn>,<tn>) |] }. end end @Class State @Grammar extends OCL.grammar State ::= n=Name { [| State(<n>) |] }. end end Tony Clark An Overview of DSLs
  • 32. Domain Specific Languages Two Types of Language Engineering The XMF Family Technologies for Language Engineering Language Factories DSM-ing as Theory Building XMF Example: State Machine Use @Class StateMachineGenerator @Attribute counter:Integer end @Operation mkStateMachine() self.counter := counter + 1; @StateMachine(Off) @State Off end @State On end @Transition(On,Off) end @Transition(Off,On) end end end end Tony Clark An Overview of DSLs
  • 33. Domain Specific Languages Two Types of Language Engineering The XMF Family Technologies for Language Engineering Language Factories DSM-ing as Theory Building Language Factories A component-based approach to the definition and construction of languages, tools. Language Factories aim to support: Reuse of common language components. Agile language engineering. Language refactoring. Language analysis including impact analysis. Product Lines for Languages Users: Language Factory Developers Language Factory Users Application Developers Application Users Tony Clark An Overview of DSLs
  • 34. Domain Specific Languages Two Types of Language Engineering The XMF Family Technologies for Language Engineering Language Factories DSM-ing as Theory Building A Language Factory lang: ast: ... grammar: ... semantics eval(env): ... semantics java: ... constraints: ... Tony Clark An Overview of DSLs
  • 35. Domain Specific Languages Two Types of Language Engineering The XMF Family Technologies for Language Engineering Language Factories DSM-ing as Theory Building Example Language component Landing_gear(height:int, speed:float) { stm { state Moving_Up state Moving_Down state Deployed state Stowed transition up from Deployed to Moving_Up height_change[height>500ft and speed>100kn/s] transition down from Stowed to Moving_Down deploy } } Tony Clark An Overview of DSLs
  • 36. Domain Specific Languages Two Types of Language Engineering The XMF Family Technologies for Language Engineering Language Factories DSM-ing as Theory Building XPL: A Calculus for DSL Analysis E ::= V variables | fun(V) E functions | E E applications | { R* } grammars | intern E { S } language use R ::= ... syntax synthesizers S ::= ... strings Tony Clark An Overview of DSLs
  • 37. Domain Specific Languages Two Types of Language Engineering The XMF Family Technologies for Language Engineering Language Factories DSM-ing as Theory Building Other Technologies UML and Profiles EMF, GMF XText Converge MetaEdit+ View based language environments. Tony Clark An Overview of DSLs
  • 38. Domain Specific Languages Two Types of Language Engineering The XMF Family Technologies for Language Engineering Language Factories DSM-ing as Theory Building Research Problems Modularity and reuse. Text-based systems and parsing. Type systems. Tooling and complexity. Interoperability. Code generation vs models at run-time. Tony Clark An Overview of DSLs
  • 39. Domain Specific Languages Two Types of Language Engineering Technologies for Language Engineering DSM-ing as Theory Building Peter Naur: Programming as Theory Building Naur’s Thesis: Programmers design theories then map them to implementations. Theories allow questions to be asked (wider scope than a run). The theories are the things that capture the domain. Don’t change the program directly, change the theory and calculate the impact. Actually multiple theories for different viewpoints. The initial theory is unattainable, but can be incrementally approximated. Tony Clark An Overview of DSLs
  • 40. Domain Specific Languages Two Types of Language Engineering Technologies for Language Engineering DSM-ing as Theory Building DSM-ing as Theory Building Tony Clark An Overview of DSLs
  • 41. Domain Specific Languages Two Types of Language Engineering Technologies for Language Engineering DSM-ing as Theory Building DSL Architecture Tony Clark An Overview of DSLs
  • 42. Domain Specific Languages Two Types of Language Engineering Technologies for Language Engineering DSM-ing as Theory Building Theory Modelling Tony Clark An Overview of DSLs
  • 43. Domain Specific Languages Two Types of Language Engineering Technologies for Language Engineering DSM-ing as Theory Building Example: Influencing Models Tony Clark An Overview of DSLs
  • 44. Domain Specific Languages Two Types of Language Engineering Technologies for Language Engineering DSM-ing as Theory Building Conclusion Domain Specific activities are about theory building and theory transformation. To be effective you need to know your terminal theory well. Terminal theories known to be effective (and universal): λ-calculus object models. Other, less universal, targets are just as effective (e.g. Java). Practical issues: really translate (code generation) simulate the transformation (interpret the model) General problems: tools to support the process. up-front resource and expertise. Tony Clark An Overview of DSLs