SlideShare uma empresa Scribd logo
1 de 59
Baixar para ler offline
Introduction to Developing Domain Specific
           Languages with XMF

                   Tony Clark

            Ceteva Ltd (www.ceteva.com)


            TOOLS Europe 2008




                Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Outline

   1   Domain Specific Languages: technologies; approaches.
   2   XMF
   3   Case Study
   4   Specification
   5   Implementation: syntax and semantics.
   6   Variations:
          1   Static Checking
          2   Dynamic Checking
          3   Arbitrary Expressions (guards)
          4   A Control Language
          5   Parameters
          6   XML Generation
          7   Code Generation
   7   Conclusion

                              Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Domain Specific Languages


     Languages are the essential technology of Software
     Engineering.
     One size fits all - problems:
         Large and complex (Ada, UML)
         Lowest common denominator (UML)
         Not accessible to non-experts.
     Domain Specific Languages (DSLs):
         Direct representation of domain concepts.
         Reduces the ’representation chasm’.
         Increased quality through domain specific checking.
         Increased utility through domain specific processing.
         (Potentially) accessible to non-experts.




                         Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Types of DSL




               Tony Clark   Introduction to Developing Domain Specific Languages with XMF
DSL Technologies



     UML and Model Driven Architecture (MDA).
     Eclipse, EMF and GMF
     Visual Studio (Software Factories).
     MetaEdit+
     OpenArchitectureWare
     XMF, XMF-Mosaic
     Ruby, Java
     Roll-your-own.




                        Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Executable Textual DSLs: A Method

Process
 1   Model input and output.
 2   Derive abstract program
     model via engine-as-relation.
 3   Flatten relationship to produce
     step-by-step engine.
 4   Introduce any implementation
     and efficiency features.
 5   Design concrete
     representation for program.
 6   Proceed with:
       1   Direct implementation.
       2   Export to external engine.
       3   Code generation.

                                Tony Clark   Introduction to Developing Domain Specific Languages with XMF
XMF



      An Engine for Model/Language Driven Development.
      Consists of:
          VM in Java.
          XCore (equivalent of MOF).
          OCL (90% complete).
          XOCL (compiles to VM in terms of XCore).
          Grammars for LOP.
          Features: XML generators; XML parsers; Model Walkers;
          Daemons; Java interface; Ecore interface; Code
          Generation.




                         Tony Clark   Introduction to Developing Domain Specific Languages with XMF
XCore




        Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Case Study


     Example taken from Martin Fowler.
     Presentation at JAOO 06:
     www.infoq.com/presentations/domain-specific-languages
     Simple problem: process raw customer, product and
     transaction data.
     Data format changes regularly.
     Many different formats in raw input.
     Fowler argues raw code, libraries and frameworks are not
     optimal.
     Use a DSL approach.




                         Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Example

 Input Data                      Result Data
                                         Customer[
     CSTM001Alan Brown                     id=1,
     PROD001100.99                         name=Alan Brown]
                                         Product[
     CSTM002Alan Smith                     id=1,
     PROD002001.99                         price=100.99]
                                         Customer[
     TRAN001001999                         id=2,
     TRAN001001000                         name=Alan Smith]
                                         Product[
                                           id=2,
                                           price=1.99]
                                         LegalTransaction[
                                           custId=1,
                                           prodId=1,
                                           amount=999]
                                         NullTransaction[
                                           custId=1,
                                           prodId=1,
                                           amount=0]

                   Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Specification: Approach




     Need to define a DSL that specifies how to turn raw data
     into records.
     An executable DSL can be defined as a 3-way relationship.
     Set up a representation for the 2 knowns.
     Use relationship definitions to force a representation for the
     unknown.
     Analyse relationship for a suitable machine definition.




                         Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Specification: Representation
     Sequences:
         empty: []
         elements: [e1 , . . .]
         concatenation: s1 + s2
     Sets:
         empty: ∅
         elements: {e1 , . . .}
         union: s1 ∪ s2
     Input lines:
         t(s), example: PROD(001100.99).
         input is sequence of lines.
     Strings: s[i, j], example: 001100.99[0,2] is 001.
     Tables:
         sets of maplets k → v .
         look-up in table t by t(k ).
     Records: r (F ) type r and maplets F .
                            Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Specification: Inducing the Program

     Specification is a relationship: input, program                   result
     Using representations for input and result, induce the
     program.
     Typical requirement:
   PROD001100.99, ???       Product({id → 001, cost → 100.99})

     What are the variable parts?
     Need program to map:
         input tag to record type
         specific fields of input string
         name each field.
     Therefore, we might have:
     ??? = Map(PROD → Product, id → [0, 2], cost → [3, 8])

                          Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Specification: Definition

  Specify execution for a singleton mapping:

             [t(s)] + i, Σ, [n]     [r (               f → s[i, j])], i
                                          f →[i,j]∈F


                    when Σ(n) = Map(t → r , F )
  Specify execution for the degenerate case:

                               i, Σ, []      [], i
  Specify execution for a sequence of mappings:

                             i1 , Σ, p1 r1 , i2
                             i2 , Σ, p2 r2 , i3
                           i1 , Σ, p1 + p2 i3


                            Tony Clark      Introduction to Developing Domain Specific Languages with XMF
Flattening




   perform([t(s)] + i, [n] + p) = [r (                  f → s[i, j])] + perform(i, p)
                                           f →[i,j]∈F
                                             when Σ(n) = Map(t → r , F )

         perform([], [])           =                                []




                           Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Abstract Syntax and semantic domain



   EMF can be used with XMF.
   Generate the EMF model.
   Input model into XMF.
   Export model as XMF code.
   XMF export to EMF too.




                           Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Working with EMF




     [1] XMF> importer := Import::Ecore::EcoreImporter();
     <Root>
     [1] XMF> importer.importFile("@reader1/model",
                                  "reader.ecore");
     <Package readers>
     [1] XMF> importer.initAll();
     true
     [1] XMF> importer.deployAll("c:/tmp");
     true
     [1] XMF>




                      Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Deploy EMF to XMF
    parserImport XOCL;
    import XOCL;
    import readers;
    context ! readers
      @Class Reader extends Syntax, Container, NamedElement
        @Attribute maps : Seq(Map) (?,!,+,-) end
        // A named-element uses symbols as names. The
        // easy way to force a symbol is to use setName...
        @Constructor(name) !
          self.setName(name)
        end
        // A container must implement add and contents.
        // We will just be adding Maps to a reader...
        @Operation add(e:Element)
          if e.isKindOf(Map)
          then self.addToMaps(e)
          else super(e)
          end
        end
        // Return the contents of the container...
        @Operation contents()
          maps
        end
      end
                       Tony Clark   Introduction to Developing Domain Specific Languages with XMF
XMF Models



    An XMF program is a collection of definitions in files.
    Definitions are named elements added to a name-space.
    Definitions may be packages, classes, operations etc.
    Typical example:
    context Root
      @Class C
        @Attribute a : String end
      end




                       Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Manifests



     Programs are built and loaded via manifests.
     A Manifest lists the files and sub-program units.
     A manifest has the following structure:
     @Manifest ManifestName
        @File file      end
        @Ref subModule end
     do
        someOptionalAction
     end




                         Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Records Manifest



     parserImport XOCL;
     parserImport Manifests;
     @Manifest readers
       p = @File readers end
       @File Field end
       @File Map end
       @File Reader end
     do p
     end;




                   Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Concrete Syntax




     XMF provides a grammar language XBNF.
     Classes can define a grammar to become a syntax-class.
     Reference the class via @ in programs.
     parserImport is used to import all syntax-classes in a
     name-space.
     DEMO: simple expression language




                         Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Expressions Grammar



     context Root
       @Class MyLang
         @Grammar
           MyLang ::=
             a = Atom (Tail^(a)             | { a }).
           Tail(left) ::=
             ’+’ right = MyLang             { left + right }
           | ’*’ right = MyLang             { left * right }.
           Atom ::= Int | ’(’ a             = MyLang ’)’ { a }.
         end
       end




                   Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Expressions Parsing




     MyLang.grammar.parseString("1");
     MyLang.grammar.parseString("1 + 2");
     MyLang.grammar.parseString("1 + 2 * 5");
     MyLang.grammar.parseString("(1 + 2) * 5");




                      Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Performable Syntax


     XMF execution process.
     Parser is hi-jacked using
     @.
     DEMO: modify MyLang to
     produce syntax.

     Pretend to use concrete
     syntax using quasi-quotes.
     DEMO: modify MyLang to
     use quasi-quotes.

     Protect abstract syntax
     using XOCL::Syntax
     DEMO: implement own
     AST and perform.

                          Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Expressions Parser Modification (1)


     import OCL;
     context Root
       @Class MyLang
         @Grammar
           MyLang ::= e = Exp ’end’ { e }.
           Exp ::=
             a = Atom (Tail^(a) | { a }).
           Tail(left) ::=
             ’+’ right = Exp { BinExp(left,"+",right) }
           | ’*’ right = Exp { BinExp(left,"*",right) }.
           Atom ::=
             i = Int { IntExp(i) }
           | v = Name { Var(v) }
           | ’(’ a = Exp ’)’ { a }.
         end
       end




                      Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Expressions Parser Modification (2)


     context Root
       @Class MyLang
         @Grammar
           MyLang ::= e = Exp ’end’ { e }.
           Exp ::=
             a = Atom (Tail^(a) | { a }).
           Tail(left) ::=
             ’+’ right = Exp { [| <left> + <right> |] }
           | ’*’ right = Exp { [| <left> * <right> |] }.
           Atom ::=
             i = Int { i.lift() }
           | v = Name { Var(v) }
           | ’(’ a = Exp ’)’ { a }.
         end
       end




                      Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Expressions Abstract Syntax




                   Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Expressions Parser Modification (3)


     import exps;
     context Root
       @Class MyLang
         @Grammar
           MyLang ::= e = Exp ’end’ { e }.
           Exp ::=
             a = Atom (Tail^(a) | { a }).
           Tail(left) ::=
             ’+’ right = Exp { BinExp(left,"+",right) }
           | ’*’ right = Exp { BinExp(left,"*",right) }.
           Atom ::=
             i = Int { exps::IntExp(i) }
           | ’(’ a = Exp ’)’ { a }.
         end
       end




                      Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Writing an Interpreter

      context Exp
        @AbstractOp perform():Integer end
      context BinExp
        @Operation perform():Integer
          @Case op of
            "+" do
              left.perform() + right.perform()
            end
            "*" do
              left.perform() * right.perform()
            end
          end
        end
      context IntExp
        @Operation perform()
          value
        end



                       Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Case Study: Concrete Syntax



     Look at the structure of the abstract syntax.
     What are the containership relationships?
     What needs to be named?
     Single or multiple language features?
     What ’noise’ will make it easy to read?
     Will it be owned by its containing structure?
     How does the enclosing binding context fit in?
     What is being defined and what is being used?




                         Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Reader Concrete Syntax



                               @Reader X
                                 @Map Customer(CSTM -> Customer)
                                   id = [4,6]
                                   name = [7,20]
                                 end
                                 @Map Product(PROD -> Product)
                                   id = [4,6]
                                   price = [7,12]
                                 end
                                 @Map Transaction(TRAN -> Transaction)
                                   custId = [4,6]
                                   prodId = [7,9]
                                   amount = [10,12]
                                 end
                               end




                  Tony Clark      Introduction to Developing Domain Specific Languages with XMF
Reader Grammar

    parserImport XOCL;
    parserImport Parser::BNF;
    context Reader

      @Grammar extends OCL::OCL.grammar

       //   The reader grammar inherits from the OCL grammar to
       //   reference Exp. This allows the @Map ... end language
       //   construct to be nested inside a @Reader ... end
       //   construct.

       // A reader language construct just parses the contents
       //and add them to a newly created reader object...

       Reader ::= n = Name maps = Exp* ’end’ {
          maps->iterate(m r = Reader(n) |
            r.add(m))
       }.

     end



                        Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Map Grammar


    parserImport XOCL;
    parserImport Parser::BNF;
    context Map

      @Grammar

        Map ::= n = Name ’(’ t = Name ’->’ r = Name ’)’
          fields = Field* ’end’ {
             fields->iterate(f m = Map(n,t,r) |
               m.add(f))
          }.

       Field ::= n = Name ’=’ ’[’ s = Int ’,’ e = Int ’]’ {
          Field(n,s,e)
       }.

     end




                       Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Execution Engine


  Execution engine must implement the specification.
      Input text is provided by a Data class.

      Singleton rule is implemented by Map::process and
      Field::process.

      Sequence of maps is implemented by
      Reader::processMaps.
  Visit Reader aspect
      Derive input from a file using Reader::processFile.




                          Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Variation 1: Static Checking



     Programs that are syntactically correct may have semantic
     errors.
     Two types of semantic error:
         static
         dynamic
     Example static errors: Map(t → r , f → [3, 1], f → [4, 10])
     Specifications: ∀Map(t → r , F ) ∈ Σ:
         ∀f → [i, j] ∈ F • i < j
         ∀f1 → [i, j], f2 → [m, n] ∈ F • f1 = f2 =⇒ i = m ∧ j = n




                          Tony Clark   Introduction to Developing Domain Specific Languages with XMF
XMF Constraints


     Static checks are implemented as XMF constraints.
     What can you do with XMF constraints?
         Check an object satisfies some conditions.
         Produce a test report.
         Produce an HTML report.
     Basic structure:
     context SomeClass
       @Constraint Name
         OCLExpression
       fail StringExpression
       end



                        Tony Clark   Introduction to Developing Domain Specific Languages with XMF
OCL in XMF




    OCL is an OMG standard. XMF implements most of OCL.
    OCL consists of:
        basic expressions.
        iteration: collect; select; reject; iterate.
        quantification: forAll; exists




                           Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Case Study Constraints



     Define constraints as an aspect on model.
     Use X.checkConstraints() to produce a constraint
     report.
     Check satisfaction using
     ConstraintReport::satisfied.
     Get text report using
     ConstraintReport::reportString()
     Get HTML report using
     ConstraintReport::writeHTML(path:String)




                       Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Variation 2: Dynamic Checking


     Extend the language with typed fields:
          [t(s)] + i, Σ, [n]    [r (               f → τ (s[i, j]))], i
                                    f →τ [i,j]∈F


                   when Σ(n) = Map(t → r , F )

     Rest of specification/flattening is same.
     Type errors occur when τ (s)is not defined.
     Changes to DSL:
         Modify Field to include type.
         Modify Field grammar to parse type.
         Modify engine to perform conversion.
         Throw exception when error occurs.



                           Tony Clark    Introduction to Developing Domain Specific Languages with XMF
Exceptions




     try-catch in XMF
     Exceptions package with some examples.
     Defining your own.
     What happens when you throw them.




                         Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Checking Types




     Modify:
         Data to perform field conversion.
         Field to have a new component - type.
         Map language construct.
     DEMO.




                         Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Variation 3: Adding Guards


     Specification:
                     [t(s)] + i, Σ, [n]         [r (e)], i


               when       Σ(n) = Map(t → r , F , g)
                          e=         f → τ (s[i, j])
                                 f →τ [i,j]∈F
                          g(e)

     Modifications to engine:
         Need a language for boolean expressions.
         Can now have multiple mappings with the same name.
         Distinguish between mappings based on guard satisfaction.



                          Tony Clark    Introduction to Developing Domain Specific Languages with XMF
Expressions and Evaluation




     XCore::Performable interface:
     compile(env:Compiler::Env,frame:Integer,isLast:Boolean,saveSource:Boolean):Seq(Instr)
     eval(target,env:Seq(Binding),imports:Seq(NameSpace))
     FV():Set(String)



     Environments represented as sequences of pairs.

     Use Exp from OCL grammar to embed expressions in
     languages.




                               Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Case Study Modification




     Add guards to Map language construct.
     Implement a Map::satisfied operation.
     Use Map::satisfied to select the correct mapping in Reader.




                        Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Variation 4: A Control Feature




     Programs often consist of definitions and some control.
     We have mapping definitions.
     Our control is currently a sequence of mapping names.
     More useful to allow:
         Optional formats in input.
         Arbitrary repetition.
         Sequences of control.




                          Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Specification: Optional Input Formats


     Want to achieve the following for the same program p:
                       [t(s)] + i, Σ, p      [r (e)], i


                      [t (s )] + i, Σ, p     [r (e )], i

     Generalize to:
                           i1 + i2 , Σ, p     r , i2


                          i1 + i2 , Σ, p     r , i2

     Design a construct that contains two alternative controls.



                            Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Specification: Repetition


     Want to achieve a sequence of arbitrary length:
                       [t(s)] + i, Σ, p         [r (e)], i


               [t(s), t(s )] + i, Σ, p          [r (e), r (e )], i


           [t(s), t(s ), . . .] + i, Σ, p       [r (e), r (e ), . . .], i

     Degenerate case:
                            [] + i, Σ, p        [], i

     Design a construct that consumes sequences of input.



                            Tony Clark      Introduction to Developing Domain Specific Languages with XMF
Specification

  Specify execution for a singleton mapping:

        [t(s)] + i, Σ, n     [r (e)], i       when          . . . as     before
  Specify execution for the degenerate case:

                                   i, Σ,      [], i
  Specify execution for a sequence of mappings:

                                i1 , Σ, p1 r1 , i2
                                i2 , Σ, p2 r2 , i3
                                i1 , Σ, p1 p2 i3
  Alternatives:
                     i1 ,Σ,p1 r ,i2                i1 ,Σ,p2 r ,i2
                   i1 ,Σ,p1 |p2 r ,i2            i1 ,Σ,p1 |p2 r ,i2


                                Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Abstract Syntax




     Need a new language structure.
     Define an EMF model for the commands:
         And
         Star
         Or
         Call
         OK




                       Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Command Engine

  process(ok , i, s, f )                = s([], i, f )

  process(n, [t(s)] + i, s, f ) = s([r (e)], i, f ) when                          ...
                                = f () otherwise

  process(c1 c2 , i, s, f )             = process(c1 , i, s , f )
                                            where s (v1 , i, f ) =
                                              process(c2 , i, s , f )
                                                where s (v2 , i, f ) =
                                                  s(v1 + v2 , i, f )

  process(c1 , | c2 , i, s, f )         = process(c1 , i, s, f )
                                            where f () = process(c2 , i, s, f )

  process(c ∗ , i, s, f )               = process((cc∗) | ok , i, s, f )


                                  Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Backtracking




     Alternatives require a new execution mechanism:
         Try one alternative.
         If it fails, try the other from the same point in the input.
     Modify Data to support backtracking.




                           Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Execution Engine




     Implement engine in XMF




                      Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Concrete Syntax




     A new language construct that can be embedded in XMF
     programs:
     context Root
       @Operation test1()
         @Read(X <- "@reader/tests/test1.txt")
           (Customer | Product | Transaction)*
         end
       end




                      Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Variation 5: Parameters and Locals




     Add Parameters to Mapping Definitions.
     Exercise left to reader.




                         Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Variation 6: Generating XML



     Use the PrintXML language feature:
     parserImport XML::PrintXML;
     ...
       @XML(out)
         <TAG ATTS>
           ...
         </TAG>
       end
     ...




                       Tony Clark   Introduction to Developing Domain Specific Languages with XMF
XML Generation for Reader

     parserImport XOCL;
     parserImport XML::PrintXML;
     import readers;
     import IO;
     context Reader
      @Operation toXML(out:OutputChannel)
        @XML(out)
          <Reader name=name>
            @For map in maps do
              map.toXML(out)
            end
          </Reader>
        end
      end


                   Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Variation 7: Code Generation




     Generate Framework Code from Reader Definition.
     Exercise left to reader.




                         Tony Clark   Introduction to Developing Domain Specific Languages with XMF
Conclusion




     XMF is an engine for modelling/prototyping systems.
     XMF supports a Language Oriented Approach.
     Domain Specific Languages offer advantages.
     XMF is open-source (www.ceteva.com).
     Many examples described in Superlanguages: Developing
     Languages and Applications with XMF.




                        Tony Clark   Introduction to Developing Domain Specific Languages with XMF

Mais conteúdo relacionado

Mais procurados

Creating Domain Specific Languages in Python
Creating Domain Specific Languages in PythonCreating Domain Specific Languages in Python
Creating Domain Specific Languages in PythonSiddhi
 
Chapter Seven(1)
Chapter Seven(1)Chapter Seven(1)
Chapter Seven(1)bolovv
 
Chapter Seven(2)
Chapter Seven(2)Chapter Seven(2)
Chapter Seven(2)bolovv
 
Oops concept in c#
Oops concept in c#Oops concept in c#
Oops concept in c#ANURAG SINGH
 
Object Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part IIIObject Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part IIIAjit Nayak
 
The Ring programming language version 1.10 book - Part 100 of 212
The Ring programming language version 1.10 book - Part 100 of 212The Ring programming language version 1.10 book - Part 100 of 212
The Ring programming language version 1.10 book - Part 100 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 187 of 194
The Ring programming language version 1.5.3 book - Part 187 of 194The Ring programming language version 1.5.3 book - Part 187 of 194
The Ring programming language version 1.5.3 book - Part 187 of 194Mahmoud Samir Fayed
 
20.5 Java polymorphism
20.5 Java polymorphism 20.5 Java polymorphism
20.5 Java polymorphism Intro C# Book
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console ProgramHock Leng PUAH
 
Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Abou Bakr Ashraf
 
C# Summer course - Lecture 4
C# Summer course - Lecture 4C# Summer course - Lecture 4
C# Summer course - Lecture 4mohamedsamyali
 
The Ring programming language version 1.5.1 book - Part 174 of 180
The Ring programming language version 1.5.1 book - Part 174 of 180 The Ring programming language version 1.5.1 book - Part 174 of 180
The Ring programming language version 1.5.1 book - Part 174 of 180 Mahmoud Samir Fayed
 
C# Summer course - Lecture 3
C# Summer course - Lecture 3C# Summer course - Lecture 3
C# Summer course - Lecture 3mohamedsamyali
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisEelco Visser
 

Mais procurados (18)

Creating Domain Specific Languages in Python
Creating Domain Specific Languages in PythonCreating Domain Specific Languages in Python
Creating Domain Specific Languages in Python
 
Chapter Seven(1)
Chapter Seven(1)Chapter Seven(1)
Chapter Seven(1)
 
Chapter Seven(2)
Chapter Seven(2)Chapter Seven(2)
Chapter Seven(2)
 
C sharp chap4
C sharp chap4C sharp chap4
C sharp chap4
 
Oops concept in c#
Oops concept in c#Oops concept in c#
Oops concept in c#
 
Basic c#
Basic c#Basic c#
Basic c#
 
Object Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part IIIObject Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part III
 
The Ring programming language version 1.10 book - Part 100 of 212
The Ring programming language version 1.10 book - Part 100 of 212The Ring programming language version 1.10 book - Part 100 of 212
The Ring programming language version 1.10 book - Part 100 of 212
 
The Ring programming language version 1.5.3 book - Part 187 of 194
The Ring programming language version 1.5.3 book - Part 187 of 194The Ring programming language version 1.5.3 book - Part 187 of 194
The Ring programming language version 1.5.3 book - Part 187 of 194
 
20.5 Java polymorphism
20.5 Java polymorphism 20.5 Java polymorphism
20.5 Java polymorphism
 
java tutorial 2
 java tutorial 2 java tutorial 2
java tutorial 2
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console Program
 
Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Visula C# Programming Lecture 6
Visula C# Programming Lecture 6
 
C# Summer course - Lecture 4
C# Summer course - Lecture 4C# Summer course - Lecture 4
C# Summer course - Lecture 4
 
Introduction to Linq
Introduction to LinqIntroduction to Linq
Introduction to Linq
 
The Ring programming language version 1.5.1 book - Part 174 of 180
The Ring programming language version 1.5.1 book - Part 174 of 180 The Ring programming language version 1.5.1 book - Part 174 of 180
The Ring programming language version 1.5.1 book - Part 174 of 180
 
C# Summer course - Lecture 3
C# Summer course - Lecture 3C# Summer course - Lecture 3
C# Summer course - Lecture 3
 
Compiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow AnalysisCompiler Construction | Lecture 10 | Data-Flow Analysis
Compiler Construction | Lecture 10 | Data-Flow Analysis
 

Destaque

Patterns 200711
Patterns 200711Patterns 200711
Patterns 200711ClarkTony
 
Leap isec 2011
Leap isec 2011Leap isec 2011
Leap isec 2011ClarkTony
 
Kiss at oopsla 09
Kiss at oopsla 09Kiss at oopsla 09
Kiss at oopsla 09ClarkTony
 
Dsl overview
Dsl overviewDsl overview
Dsl overviewClarkTony
 

Destaque (6)

Hcse pres
Hcse presHcse pres
Hcse pres
 
Ast 09
Ast 09Ast 09
Ast 09
 
Patterns 200711
Patterns 200711Patterns 200711
Patterns 200711
 
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
 
Dsl overview
Dsl overviewDsl overview
Dsl overview
 

Semelhante a Dsl tutorial

Kings 120711
Kings 120711Kings 120711
Kings 120711ClarkTony
 
Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#Tomas Petricek
 
Uni texus austin
Uni texus austinUni texus austin
Uni texus austinN/A
 
고급컴파일러구성론_개레_230303.pptx
고급컴파일러구성론_개레_230303.pptx고급컴파일러구성론_개레_230303.pptx
고급컴파일러구성론_개레_230303.pptxssuser1e7611
 
Introduction To Erlang Final
Introduction To Erlang   FinalIntroduction To Erlang   Final
Introduction To Erlang FinalSinarShebl
 
Building a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGLBuilding a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGLLuka Jacobowitz
 
Re-implementing Thrift using MDE
Re-implementing Thrift using MDERe-implementing Thrift using MDE
Re-implementing Thrift using MDESina Madani
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMRaveen Perera
 
Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Jimmy Schementi
 
Vitalii Braslavskyi - Declarative engineering
Vitalii Braslavskyi - Declarative engineering Vitalii Braslavskyi - Declarative engineering
Vitalii Braslavskyi - Declarative engineering Grammarly
 
Vitalii Braslavskyi "Declarative engineering"
Vitalii Braslavskyi "Declarative engineering"Vitalii Braslavskyi "Declarative engineering"
Vitalii Braslavskyi "Declarative engineering"Fwdays
 
Internationlization
InternationlizationInternationlization
InternationlizationTuan Ngo
 
U Xml Defense presentation
U Xml Defense presentationU Xml Defense presentation
U Xml Defense presentationksp4186
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overviewsapdocs. info
 
Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01tabish
 
chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01tabish
 
Chapter 1 Abap Programming Overview
Chapter 1 Abap Programming OverviewChapter 1 Abap Programming Overview
Chapter 1 Abap Programming OverviewAshish Kumar
 

Semelhante a Dsl tutorial (20)

Kings 120711
Kings 120711Kings 120711
Kings 120711
 
Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#Creating Domain Specific Languages in F#
Creating Domain Specific Languages in F#
 
Uni texus austin
Uni texus austinUni texus austin
Uni texus austin
 
고급컴파일러구성론_개레_230303.pptx
고급컴파일러구성론_개레_230303.pptx고급컴파일러구성론_개레_230303.pptx
고급컴파일러구성론_개레_230303.pptx
 
Clojure intro
Clojure introClojure intro
Clojure intro
 
Introduction To Erlang Final
Introduction To Erlang   FinalIntroduction To Erlang   Final
Introduction To Erlang Final
 
Building a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGLBuilding a Tagless Final DSL for WebGL
Building a Tagless Final DSL for WebGL
 
Re-implementing Thrift using MDE
Re-implementing Thrift using MDERe-implementing Thrift using MDE
Re-implementing Thrift using MDE
 
Coding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBMCoding in GO - GDG SL - NSBM
Coding in GO - GDG SL - NSBM
 
Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011
 
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"
 
Introduce to Terraform
Introduce to TerraformIntroduce to Terraform
Introduce to Terraform
 
Internationlization
InternationlizationInternationlization
Internationlization
 
F#3.0
F#3.0 F#3.0
F#3.0
 
U Xml Defense presentation
U Xml Defense presentationU Xml Defense presentation
U Xml Defense presentation
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overview
 
Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01
 
chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01
 
Chapter 1 Abap Programming Overview
Chapter 1 Abap Programming OverviewChapter 1 Abap Programming Overview
Chapter 1 Abap Programming Overview
 

Mais de ClarkTony

The Uncertain Enterprise
The Uncertain EnterpriseThe Uncertain Enterprise
The Uncertain EnterpriseClarkTony
 
Actors for Behavioural Simulation
Actors for Behavioural SimulationActors for Behavioural Simulation
Actors for Behavioural SimulationClarkTony
 
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 AnalysisClarkTony
 
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 ArchitectureClarkTony
 
Context Aware Reactive Applications
Context Aware Reactive ApplicationsContext Aware Reactive Applications
Context Aware Reactive ApplicationsClarkTony
 
Model Slicing
Model SlicingModel Slicing
Model SlicingClarkTony
 
Iswim for testing
Iswim for testingIswim for testing
Iswim for testingClarkTony
 
Iswim for testing
Iswim for testingIswim for testing
Iswim for testingClarkTony
 
Mcms and ids sig
Mcms and ids sigMcms and ids sig
Mcms and ids sigClarkTony
 
Reverse engineering and theory building v3
Reverse engineering and theory building v3Reverse engineering and theory building v3
Reverse engineering and theory building v3ClarkTony
 
Onward presentation.en
Onward presentation.enOnward presentation.en
Onward presentation.enClarkTony
 
Formalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsFormalizing homogeneous language embeddings
Formalizing homogeneous language embeddingsClarkTony
 
Filmstrip testing
Filmstrip testingFilmstrip testing
Filmstrip testingClarkTony
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory buildingClarkTony
 
Code gen 09 kiss results
Code gen 09   kiss resultsCode gen 09   kiss results
Code gen 09 kiss resultsClarkTony
 
Iswim for testing
Iswim for testingIswim for testing
Iswim for testingClarkTony
 

Mais 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
 
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
 
Scam 08
Scam 08Scam 08
Scam 08
 
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
 

Último

A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Último (20)

A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

Dsl tutorial

  • 1. Introduction to Developing Domain Specific Languages with XMF Tony Clark Ceteva Ltd (www.ceteva.com) TOOLS Europe 2008 Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 2. Outline 1 Domain Specific Languages: technologies; approaches. 2 XMF 3 Case Study 4 Specification 5 Implementation: syntax and semantics. 6 Variations: 1 Static Checking 2 Dynamic Checking 3 Arbitrary Expressions (guards) 4 A Control Language 5 Parameters 6 XML Generation 7 Code Generation 7 Conclusion Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 3. Domain Specific Languages Languages are the essential technology of Software Engineering. One size fits all - problems: Large and complex (Ada, UML) Lowest common denominator (UML) Not accessible to non-experts. Domain Specific Languages (DSLs): Direct representation of domain concepts. Reduces the ’representation chasm’. Increased quality through domain specific checking. Increased utility through domain specific processing. (Potentially) accessible to non-experts. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 4. Types of DSL Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 5. DSL Technologies UML and Model Driven Architecture (MDA). Eclipse, EMF and GMF Visual Studio (Software Factories). MetaEdit+ OpenArchitectureWare XMF, XMF-Mosaic Ruby, Java Roll-your-own. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 6. Executable Textual DSLs: A Method Process 1 Model input and output. 2 Derive abstract program model via engine-as-relation. 3 Flatten relationship to produce step-by-step engine. 4 Introduce any implementation and efficiency features. 5 Design concrete representation for program. 6 Proceed with: 1 Direct implementation. 2 Export to external engine. 3 Code generation. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 7. XMF An Engine for Model/Language Driven Development. Consists of: VM in Java. XCore (equivalent of MOF). OCL (90% complete). XOCL (compiles to VM in terms of XCore). Grammars for LOP. Features: XML generators; XML parsers; Model Walkers; Daemons; Java interface; Ecore interface; Code Generation. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 8. XCore Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 9. Case Study Example taken from Martin Fowler. Presentation at JAOO 06: www.infoq.com/presentations/domain-specific-languages Simple problem: process raw customer, product and transaction data. Data format changes regularly. Many different formats in raw input. Fowler argues raw code, libraries and frameworks are not optimal. Use a DSL approach. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 10. Example Input Data Result Data Customer[ CSTM001Alan Brown id=1, PROD001100.99 name=Alan Brown] Product[ CSTM002Alan Smith id=1, PROD002001.99 price=100.99] Customer[ TRAN001001999 id=2, TRAN001001000 name=Alan Smith] Product[ id=2, price=1.99] LegalTransaction[ custId=1, prodId=1, amount=999] NullTransaction[ custId=1, prodId=1, amount=0] Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 11. Specification: Approach Need to define a DSL that specifies how to turn raw data into records. An executable DSL can be defined as a 3-way relationship. Set up a representation for the 2 knowns. Use relationship definitions to force a representation for the unknown. Analyse relationship for a suitable machine definition. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 12. Specification: Representation Sequences: empty: [] elements: [e1 , . . .] concatenation: s1 + s2 Sets: empty: ∅ elements: {e1 , . . .} union: s1 ∪ s2 Input lines: t(s), example: PROD(001100.99). input is sequence of lines. Strings: s[i, j], example: 001100.99[0,2] is 001. Tables: sets of maplets k → v . look-up in table t by t(k ). Records: r (F ) type r and maplets F . Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 13. Specification: Inducing the Program Specification is a relationship: input, program result Using representations for input and result, induce the program. Typical requirement: PROD001100.99, ??? Product({id → 001, cost → 100.99}) What are the variable parts? Need program to map: input tag to record type specific fields of input string name each field. Therefore, we might have: ??? = Map(PROD → Product, id → [0, 2], cost → [3, 8]) Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 14. Specification: Definition Specify execution for a singleton mapping: [t(s)] + i, Σ, [n] [r ( f → s[i, j])], i f →[i,j]∈F when Σ(n) = Map(t → r , F ) Specify execution for the degenerate case: i, Σ, [] [], i Specify execution for a sequence of mappings: i1 , Σ, p1 r1 , i2 i2 , Σ, p2 r2 , i3 i1 , Σ, p1 + p2 i3 Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 15. Flattening perform([t(s)] + i, [n] + p) = [r ( f → s[i, j])] + perform(i, p) f →[i,j]∈F when Σ(n) = Map(t → r , F ) perform([], []) = [] Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 16. Abstract Syntax and semantic domain EMF can be used with XMF. Generate the EMF model. Input model into XMF. Export model as XMF code. XMF export to EMF too. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 17. Working with EMF [1] XMF> importer := Import::Ecore::EcoreImporter(); <Root> [1] XMF> importer.importFile("@reader1/model", "reader.ecore"); <Package readers> [1] XMF> importer.initAll(); true [1] XMF> importer.deployAll("c:/tmp"); true [1] XMF> Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 18. Deploy EMF to XMF parserImport XOCL; import XOCL; import readers; context ! readers @Class Reader extends Syntax, Container, NamedElement @Attribute maps : Seq(Map) (?,!,+,-) end // A named-element uses symbols as names. The // easy way to force a symbol is to use setName... @Constructor(name) ! self.setName(name) end // A container must implement add and contents. // We will just be adding Maps to a reader... @Operation add(e:Element) if e.isKindOf(Map) then self.addToMaps(e) else super(e) end end // Return the contents of the container... @Operation contents() maps end end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 19. XMF Models An XMF program is a collection of definitions in files. Definitions are named elements added to a name-space. Definitions may be packages, classes, operations etc. Typical example: context Root @Class C @Attribute a : String end end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 20. Manifests Programs are built and loaded via manifests. A Manifest lists the files and sub-program units. A manifest has the following structure: @Manifest ManifestName @File file end @Ref subModule end do someOptionalAction end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 21. Records Manifest parserImport XOCL; parserImport Manifests; @Manifest readers p = @File readers end @File Field end @File Map end @File Reader end do p end; Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 22. Concrete Syntax XMF provides a grammar language XBNF. Classes can define a grammar to become a syntax-class. Reference the class via @ in programs. parserImport is used to import all syntax-classes in a name-space. DEMO: simple expression language Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 23. Expressions Grammar context Root @Class MyLang @Grammar MyLang ::= a = Atom (Tail^(a) | { a }). Tail(left) ::= ’+’ right = MyLang { left + right } | ’*’ right = MyLang { left * right }. Atom ::= Int | ’(’ a = MyLang ’)’ { a }. end end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 24. Expressions Parsing MyLang.grammar.parseString("1"); MyLang.grammar.parseString("1 + 2"); MyLang.grammar.parseString("1 + 2 * 5"); MyLang.grammar.parseString("(1 + 2) * 5"); Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 25. Performable Syntax XMF execution process. Parser is hi-jacked using @. DEMO: modify MyLang to produce syntax. Pretend to use concrete syntax using quasi-quotes. DEMO: modify MyLang to use quasi-quotes. Protect abstract syntax using XOCL::Syntax DEMO: implement own AST and perform. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 26. Expressions Parser Modification (1) import OCL; context Root @Class MyLang @Grammar MyLang ::= e = Exp ’end’ { e }. Exp ::= a = Atom (Tail^(a) | { a }). Tail(left) ::= ’+’ right = Exp { BinExp(left,"+",right) } | ’*’ right = Exp { BinExp(left,"*",right) }. Atom ::= i = Int { IntExp(i) } | v = Name { Var(v) } | ’(’ a = Exp ’)’ { a }. end end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 27. Expressions Parser Modification (2) context Root @Class MyLang @Grammar MyLang ::= e = Exp ’end’ { e }. Exp ::= a = Atom (Tail^(a) | { a }). Tail(left) ::= ’+’ right = Exp { [| <left> + <right> |] } | ’*’ right = Exp { [| <left> * <right> |] }. Atom ::= i = Int { i.lift() } | v = Name { Var(v) } | ’(’ a = Exp ’)’ { a }. end end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 28. Expressions Abstract Syntax Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 29. Expressions Parser Modification (3) import exps; context Root @Class MyLang @Grammar MyLang ::= e = Exp ’end’ { e }. Exp ::= a = Atom (Tail^(a) | { a }). Tail(left) ::= ’+’ right = Exp { BinExp(left,"+",right) } | ’*’ right = Exp { BinExp(left,"*",right) }. Atom ::= i = Int { exps::IntExp(i) } | ’(’ a = Exp ’)’ { a }. end end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 30. Writing an Interpreter context Exp @AbstractOp perform():Integer end context BinExp @Operation perform():Integer @Case op of "+" do left.perform() + right.perform() end "*" do left.perform() * right.perform() end end end context IntExp @Operation perform() value end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 31. Case Study: Concrete Syntax Look at the structure of the abstract syntax. What are the containership relationships? What needs to be named? Single or multiple language features? What ’noise’ will make it easy to read? Will it be owned by its containing structure? How does the enclosing binding context fit in? What is being defined and what is being used? Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 32. Reader Concrete Syntax @Reader X @Map Customer(CSTM -> Customer) id = [4,6] name = [7,20] end @Map Product(PROD -> Product) id = [4,6] price = [7,12] end @Map Transaction(TRAN -> Transaction) custId = [4,6] prodId = [7,9] amount = [10,12] end end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 33. Reader Grammar parserImport XOCL; parserImport Parser::BNF; context Reader @Grammar extends OCL::OCL.grammar // The reader grammar inherits from the OCL grammar to // reference Exp. This allows the @Map ... end language // construct to be nested inside a @Reader ... end // construct. // A reader language construct just parses the contents //and add them to a newly created reader object... Reader ::= n = Name maps = Exp* ’end’ { maps->iterate(m r = Reader(n) | r.add(m)) }. end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 34. Map Grammar parserImport XOCL; parserImport Parser::BNF; context Map @Grammar Map ::= n = Name ’(’ t = Name ’->’ r = Name ’)’ fields = Field* ’end’ { fields->iterate(f m = Map(n,t,r) | m.add(f)) }. Field ::= n = Name ’=’ ’[’ s = Int ’,’ e = Int ’]’ { Field(n,s,e) }. end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 35. Execution Engine Execution engine must implement the specification. Input text is provided by a Data class. Singleton rule is implemented by Map::process and Field::process. Sequence of maps is implemented by Reader::processMaps. Visit Reader aspect Derive input from a file using Reader::processFile. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 36. Variation 1: Static Checking Programs that are syntactically correct may have semantic errors. Two types of semantic error: static dynamic Example static errors: Map(t → r , f → [3, 1], f → [4, 10]) Specifications: ∀Map(t → r , F ) ∈ Σ: ∀f → [i, j] ∈ F • i < j ∀f1 → [i, j], f2 → [m, n] ∈ F • f1 = f2 =⇒ i = m ∧ j = n Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 37. XMF Constraints Static checks are implemented as XMF constraints. What can you do with XMF constraints? Check an object satisfies some conditions. Produce a test report. Produce an HTML report. Basic structure: context SomeClass @Constraint Name OCLExpression fail StringExpression end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 38. OCL in XMF OCL is an OMG standard. XMF implements most of OCL. OCL consists of: basic expressions. iteration: collect; select; reject; iterate. quantification: forAll; exists Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 39. Case Study Constraints Define constraints as an aspect on model. Use X.checkConstraints() to produce a constraint report. Check satisfaction using ConstraintReport::satisfied. Get text report using ConstraintReport::reportString() Get HTML report using ConstraintReport::writeHTML(path:String) Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 40. Variation 2: Dynamic Checking Extend the language with typed fields: [t(s)] + i, Σ, [n] [r ( f → τ (s[i, j]))], i f →τ [i,j]∈F when Σ(n) = Map(t → r , F ) Rest of specification/flattening is same. Type errors occur when τ (s)is not defined. Changes to DSL: Modify Field to include type. Modify Field grammar to parse type. Modify engine to perform conversion. Throw exception when error occurs. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 41. Exceptions try-catch in XMF Exceptions package with some examples. Defining your own. What happens when you throw them. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 42. Checking Types Modify: Data to perform field conversion. Field to have a new component - type. Map language construct. DEMO. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 43. Variation 3: Adding Guards Specification: [t(s)] + i, Σ, [n] [r (e)], i when Σ(n) = Map(t → r , F , g) e= f → τ (s[i, j]) f →τ [i,j]∈F g(e) Modifications to engine: Need a language for boolean expressions. Can now have multiple mappings with the same name. Distinguish between mappings based on guard satisfaction. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 44. Expressions and Evaluation XCore::Performable interface: compile(env:Compiler::Env,frame:Integer,isLast:Boolean,saveSource:Boolean):Seq(Instr) eval(target,env:Seq(Binding),imports:Seq(NameSpace)) FV():Set(String) Environments represented as sequences of pairs. Use Exp from OCL grammar to embed expressions in languages. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 45. Case Study Modification Add guards to Map language construct. Implement a Map::satisfied operation. Use Map::satisfied to select the correct mapping in Reader. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 46. Variation 4: A Control Feature Programs often consist of definitions and some control. We have mapping definitions. Our control is currently a sequence of mapping names. More useful to allow: Optional formats in input. Arbitrary repetition. Sequences of control. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 47. Specification: Optional Input Formats Want to achieve the following for the same program p: [t(s)] + i, Σ, p [r (e)], i [t (s )] + i, Σ, p [r (e )], i Generalize to: i1 + i2 , Σ, p r , i2 i1 + i2 , Σ, p r , i2 Design a construct that contains two alternative controls. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 48. Specification: Repetition Want to achieve a sequence of arbitrary length: [t(s)] + i, Σ, p [r (e)], i [t(s), t(s )] + i, Σ, p [r (e), r (e )], i [t(s), t(s ), . . .] + i, Σ, p [r (e), r (e ), . . .], i Degenerate case: [] + i, Σ, p [], i Design a construct that consumes sequences of input. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 49. Specification Specify execution for a singleton mapping: [t(s)] + i, Σ, n [r (e)], i when . . . as before Specify execution for the degenerate case: i, Σ, [], i Specify execution for a sequence of mappings: i1 , Σ, p1 r1 , i2 i2 , Σ, p2 r2 , i3 i1 , Σ, p1 p2 i3 Alternatives: i1 ,Σ,p1 r ,i2 i1 ,Σ,p2 r ,i2 i1 ,Σ,p1 |p2 r ,i2 i1 ,Σ,p1 |p2 r ,i2 Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 50. Abstract Syntax Need a new language structure. Define an EMF model for the commands: And Star Or Call OK Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 51. Command Engine process(ok , i, s, f ) = s([], i, f ) process(n, [t(s)] + i, s, f ) = s([r (e)], i, f ) when ... = f () otherwise process(c1 c2 , i, s, f ) = process(c1 , i, s , f ) where s (v1 , i, f ) = process(c2 , i, s , f ) where s (v2 , i, f ) = s(v1 + v2 , i, f ) process(c1 , | c2 , i, s, f ) = process(c1 , i, s, f ) where f () = process(c2 , i, s, f ) process(c ∗ , i, s, f ) = process((cc∗) | ok , i, s, f ) Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 52. Backtracking Alternatives require a new execution mechanism: Try one alternative. If it fails, try the other from the same point in the input. Modify Data to support backtracking. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 53. Execution Engine Implement engine in XMF Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 54. Concrete Syntax A new language construct that can be embedded in XMF programs: context Root @Operation test1() @Read(X <- "@reader/tests/test1.txt") (Customer | Product | Transaction)* end end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 55. Variation 5: Parameters and Locals Add Parameters to Mapping Definitions. Exercise left to reader. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 56. Variation 6: Generating XML Use the PrintXML language feature: parserImport XML::PrintXML; ... @XML(out) <TAG ATTS> ... </TAG> end ... Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 57. XML Generation for Reader parserImport XOCL; parserImport XML::PrintXML; import readers; import IO; context Reader @Operation toXML(out:OutputChannel) @XML(out) <Reader name=name> @For map in maps do map.toXML(out) end </Reader> end end Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 58. Variation 7: Code Generation Generate Framework Code from Reader Definition. Exercise left to reader. Tony Clark Introduction to Developing Domain Specific Languages with XMF
  • 59. Conclusion XMF is an engine for modelling/prototyping systems. XMF supports a Language Oriented Approach. Domain Specific Languages offer advantages. XMF is open-source (www.ceteva.com). Many examples described in Superlanguages: Developing Languages and Applications with XMF. Tony Clark Introduction to Developing Domain Specific Languages with XMF