SlideShare a Scribd company logo
1 of 65
Download to read offline
Building DSLs with Xtext

                                         Eclipse Modeling Day

                                         New York, 16 November 2009
                                         Toronto, 18 November 2009


                                         Heiko Behrens (itemis)




© itemis AG 2009 – All rights reserved
FOUNDATION
 MEMBER TM
Model-Driven Software Development
            with DSLs
Suppose...
You’d want to core an apple...
... for your kids.
?
Right tool for the job?
Your trusty swiss army knife!
Suppose...
You’d want to core a few more apples...
... for an apple cake.
Still the best tool for the job?
Better use this one.
and this one:
... a DSL is ...
A specific tool
for a specific job
A specific tool
for a specific job
Domain-Specific Language (DSL)
A DSL is a formal, processable language
  targeting at a specific viewpoint or
     aspect of a software system.
Its semantics, flexibility and notation is
 designed in order to support working
with that viewpoint as good as possible.
Rd2-c2
“ Queen to c7.
               Check.”




  “ Rd2-c2 ,
                      ”
rook at d2 moves to c2.
Moves in Chess:
!ook at a1 moves to a5.
    P
    iece           S   q uare      A
                                   ction
                                           De   stin ation


"ishop at c8 captures knight at h3.
    P
    iece            S   q uare   ion
                                           Action
                                                             D
                                                             es tinat


# b1 x c3
Piece S   qua re ction stination
              AD      e


$2 - g4
                      ation
S A D
quar
    e   ction e  stin
Rook     a1    move      a5
              Bishop   c8   capture    h3   Knight
              Knight   b1   capture    c3   Queen
               Pawn    g2    move      g4


    Game                     Move
                         Source                      «enum»
WhitePlayer
                       * Destination                  Piece
BlackPlayer
                         Piece
"ishop at c8 captures knight at h3

           " c8 x h3
Model (textfile)
White: "Mayfield"
Black: "Trinks"

pawn at e2 moves to e4
pawn at f7 moves to g5

K b1 - c3
f7 - f5

queen at d1 moves to h5
// 1-0
Xtext is a complete environment
for development of textual
 - programming languages and
 - domain-specific languages.
It is implemented in Java and is
based on Eclipse, EMF, and Antlr.
ar
Model




                                    m
                                   m
                               ra
                               G
                           Generator



        Runtime
                  Superclass




                  Subclass              Class




 LL(*) Parser   ecore meta model                editor
Grammar (similar to EBNF)
 Game:
 !   "White:" whitePlayer=STRING
 !   "Black:" blackPlayer=STRING
 !   (moves+=Move)+;
 !

 Move:
 !   AlgebraicMove | SpokenMove;

 AlgebraicMove:
 !   (piece=Piece)? source=Square (captures?='x'|'-') dest=Square;
 !

 SpokenMove:
 !   piece=Piece 'at' source=Square
 !   (captures?='captures' capturedPiece=Piece 'at' | 'moves to')
 !   dest=Square;
 !

 terminal Square:
 !   ('a'..'h')('1'..'8');
 !

 enum Piece:
 !   pawn    =   'P'   |   pawn     =   'pawn'     |
 !   knight =    'N'   |   knight   =   'knight'   |
 !   bishop =    'B'   |   bishop   =   'bishop'   |
 !   rook    =   'R'   |   rook     =   'rook'     |
 !   queen =     'Q'   |   queen    =   'queen'    |
 !   king    =   'K'   |   king     =   'king';
Demo
• Model         File within Editor + Custom View
• Xtext        Grammar for writing simple chess games
• Derived          meta model
• Java     program that works with textual models
• Xpand-based                generator




© itemis AG 2009 – All rights reserved                  31
Real World DSLs
Regular Expressions
[-+]?[0-9]*.?[0-9]+
Complex Event Processing
from FlightBookings F, CarBookings C, HotelBookings H
  matching [24 hours: F, C, H ]
  on F.name = C.name = H.name
  select F.name, true bookingWithCar,
  into TripleBookings

from FlightBookings F, CarBookings C, HotelBookings H
  matching [24 hours: F, !C, H ]
  on F.name = C.name = H.name
  select F.name, false bookingWithCar
  into TripleBookings

from TripleBookings
  where prev(bookingWithCar) and not bookingWithCar
  select name
  into LostCustomers
internal DSL
 (with Java)
Mailer.mail()
.to(“you@gmail.com”)
.from(“me@gmail.com”)
.subject(“Writing DSLs in Java”)
.body(“...”)
.send();
ANT
<project name="MyProject" default="dist" basedir=".">
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist" location="dist"/>
  <target name="init">
    <mkdir dir="${build}"/>
  </target>
  <target name="compile" depends="init">
    <javac srcdir="${src}" destdir="${build}"/>
  </target>
  <target name="dist" depends="compile">
    <mkdir dir="${dist}/lib"/>
    <jar jarfile="${dist}/lib/MyProject.jar"
         basedir="${build}"/>
  </target>
  <target name="clean">
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>
ANT
      ?
<project name="MyProject" default="dist" basedir=".">
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist" location="dist"/>
  <target name="init">
    <mkdir dir="${build}"/>
  </target>
  <target name="compile" depends="init">
    <javac srcdir="${src}" destdir="${build}"/>
  </target>
  <target name="dist" depends="compile">
    <mkdir dir="${dist}/lib"/>
    <jar jarfile="${dist}/lib/MyProject.jar"
         basedir="${build}"/>
  </target>
  <target name="clean">
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>
Entities by Example




        vs.
package templates;

import java.util.*;
import java.io.Serializable;
import javax.persistence.*;

@SuppressWarnings("serial")
@Entity
public class Customer implements Serializable {
!    private Long id;
!    private String name;
!    private Address address;
!    private Set<Order> orders = new HashSet<Order>();
!    // No-arg constructor
!    public Customer() {
!    }
!    @Id
!    public Long getId() {
!    !    return id;
!    }
!    public void setId(Long id) {
!    !    this.id = id;
!    }
!    public String getName() {
!    !    return name;
!    }
!    public void setName(String name) {
!    !    this.name = name;
!    }
!    public Address getAddress() {
!    !    return address;
!    }
!    public void setAddress(Address address) {
!    !    this.address = address;
!    }
!    @OneToMany
!    public Collection<Order> getOrders() {
!    !    return orders;
!    }
!    public void setOrders(Set<Order> orders) {
!    !    this.orders = orders;
!    }
}
package templates;

import java.io.Serializable;
import java.util.*;
import javax.persistence.*;

@SuppressWarnings("serial")
@Entity
public class Customer implements Serializable {
!    private Long id;
!    private String name;
!    private Address address;
!    private Set<Order> orders = new HashSet<Order>();
!    // No-arg constructor
!    public Customer() {
!    }
!    @Id
!    public Long getId() {
!    !    return id;
!    }
!    public void setId(Long id) {
!    !    this.id = id;
!    }
!    public String getName() {
!    !    return name;
!    }
!    public void setName(String name) {
!    !    this.name = name;
!    }
!    public Address getAddress() {
!    !    return address;
!    }
!    public void setAddress(Address address) {
!    !    this.address = address;
!    }
!    @OneToMany
!    public Collection<Order> getOrders() {
!    !    return orders;
!    }
!    public void setOrders(Set<Order> orders) {
!    !    this.orders = orders;
!    }
}
entity Customer {
! property name : String
! property address : Address
! property orders : Order[]
}




   POJOs            DAOs
The Finder Method
<entity name="Customer">
 <attribute type="String" name="name"/>
 <findMethod name="findFixed">
  <expression>
   <equals>
    <attributeRef attr="name"/>
    <constant val="John Doe"/>
   </equals>
  </expression>
 <findMethod>
</entity>



entity Customer {
! property name : String
! finder findFixed : name = "John Doe"
}
Demo

! Implement simple Entity DSL
! Use prepared Generator
grammar org.xtext.webinar.Entity
!   with org.eclipse.xtext.common.Terminals
                                              entity
generate entity
  "http://www.xtext.org/webinar/Entity"                         Model

Model:
                                                                  types
!   (elements+=Type)*;
                                                               *
Type:                                                         Type
                                                         name: EString
!   SimpleType | Entity;

SimpleType:
!   'type' name=ID;
                                                   SimpleType             Entity
Entity:                                                                              extends
!   'entity' name=ID
     ('extends' extends=[Entity])? '{'
                                                                  properties
!   !    properties+=Property*                                              *
!   '}';                                                               Property
                                                                    name: EString
                                                           type     many: EBoolean
Property:
!   'property' name=ID ':'
     type=[Type] (many?='[]')?;
grammar org.xtext.webinar.Entity
!   with org.eclipse.xtext.common.Terminals
                                              entity
generate entity
  "http://www.xtext.org/webinar/Entity"                         Model

Model:
                                                                  types
!   (elements+=Type)*;
                                                               *
Type:                                                         Type
                                                         name: EString
!   SimpleType | Entity;

SimpleType:
!   'type' name=ID;
                                                   SimpleType             Entity
Entity:                                                                              extends
!   'entity' name=ID
     ('extends' extends=[Entity])? '{'
                                                                  properties
!   !    properties+=Property*                                              *
!   '}';                                                               Property
                                                                    name: EString
                                                           type     many: EBoolean
Property:
!   'property' name=ID ':'
     type=[Type] (many?='[]')?;
grammar org.xtext.webinar.Entity
!   with org.eclipse.xtext.common.Terminals
                                              entity
generate entity
  "http://www.xtext.org/webinar/Entity"                         Model

Model:
                                                                  types
!   (elements+=Type)*;
                                                               *
Type:                                                         Type
                                                         name: EString
!   SimpleType | Entity;

SimpleType:
!   'type' name=ID;
                                                   SimpleType             Entity
Entity:                                                                              extends
!   'entity' name=ID
     ('extends' extends=[Entity])? '{'
                                                                  properties
!   !    properties+=Property*                                              *
!   '}';                                                               Property
                                                                    name: EString
                                                           type     many: EBoolean
Property:
!   'property' name=ID ':'
     type=[Type] (many?='[]')?;
grammar org.xtext.webinar.Entity
!   with org.eclipse.xtext.common.Terminals
                                              entity
generate entity
  "http://www.xtext.org/webinar/Entity"                         Model

Model:
                                                                  types
!   (elements+=Type)*;
                                                               *
Type:                                                         Type
                                                         name: EString
!   SimpleType | Entity;

SimpleType:
!   'type' name=ID;
                                                   SimpleType             Entity
Entity:                                                                              extends
!   'entity' name=ID
     ('extends' extends=[Entity])? '{'
                                                                  properties
!   !    properties+=Property*                                              *
!   '}';                                                               Property
                                                                    name: EString
                                                           type     many: EBoolean
Property:
!   'property' name=ID ':'
     type=[Type] (many?='[]')?;
grammar org.xtext.webinar.Entity
!   with org.eclipse.xtext.common.Terminals
                                              entity
generate entity
  "http://www.xtext.org/webinar/Entity"                         Model

Model:
                                                                  types
!   (elements+=Type)*;
                                                               *
Type:                                                         Type
                                                         name: EString
!   SimpleType | Entity;

SimpleType:
!   'type' name=ID;
                                                   SimpleType             Entity
Entity:                                                                              extends
!   'entity' name=ID
     ('extends' extends=[Entity])? '{'
                                                                  properties
!   !    properties+=Property*                                              *
!   '}';                                                               Property
                                                                    name: EString
                                                           type     many: EBoolean
Property:
!   'property' name=ID ':'
     type=[Type] (many?='[]')?;
grammar org.xtext.webinar.Entity
!   with org.eclipse.xtext.common.Terminals
                                              entity
generate entity
  "http://www.xtext.org/webinar/Entity"                         Model

Model:
                                                                  types
!   (elements+=Type)*;
                                                               *
Type:                                                         Type
                                                         name: EString
!   SimpleType | Entity;

SimpleType:
!   'type' name=ID;
                                                   SimpleType             Entity
Entity:                                                                              extends
!   'entity' name=ID
     ('extends' extends=[Entity])? '{'
                                                                  properties
!   !    properties+=Property*                                              *
!   '}';                                                               Property
                                                                    name: EString
                                                           type     many: EBoolean
Property:
!   'property' name=ID ':'
     type=[Type] (many?='[]')?;
grammar org.xtext.webinar.Entity
!   with org.eclipse.xtext.common.Terminals
                                              entity
generate entity
  "http://www.xtext.org/webinar/Entity"                         Model

Model:
                                                                  types
!   (elements+=Type)*;
                                                               *
Type:                                                         Type
                                                         name: EString
!   SimpleType | Entity;

SimpleType:
!   'type' name=ID;
                                                   SimpleType             Entity
Entity:                                                                              extends
!   'entity' name=ID
     ('extends' extends=[Entity])? '{'
                                                                  properties
!   !    properties+=Property*                                              *
!   '}';                                                               Property
                                                                    name: EString
                                                           type     many: EBoolean
Property:
!   'property' name=ID ':'
     type=[Type] (many?='[]')?;
Pimp
 my Write
Whitespace-Aware
  Languages
Incremental
Generation
Conclusion
Abstraction
Use a DSL to develop your tools
Support
Newsgroup
Community Forum
Professional Support
twitter @HBehrens
blog http://HeikoBehrens.net

mail       Heiko.Behrens@itemis.de
xing       http://www.xing.com/profile/Heiko_Behrens
linkedin   http://www.linkedin.com/in/HeikoBehrens




                                                                                            www.xtext.org
                 The Committer Team                                                         twitter @Xtext




 Heiko      Michael    Sven       Moritz    Peter     Dennis     Jan        Patrick     Knut      Sebastian
Behrens      Clay     Efftinge   Eysholdt   Friese    Hübner   Köhnlein   Schönbach   Wannheden   Zarnekow

More Related Content

What's hot

IronSmalltalk
IronSmalltalkIronSmalltalk
IronSmalltalkESUG
 
Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Andreas Dewes
 
Learning from other's mistakes: Data-driven code analysis
Learning from other's mistakes: Data-driven code analysisLearning from other's mistakes: Data-driven code analysis
Learning from other's mistakes: Data-driven code analysisAndreas Dewes
 
Codegeneration Goodies
Codegeneration GoodiesCodegeneration Goodies
Codegeneration Goodiesmeysholdt
 
Extending the Xbase Typesystem
Extending the Xbase TypesystemExtending the Xbase Typesystem
Extending the Xbase TypesystemSebastian Zarnekow
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingHoat Le
 
PHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing InsanityPHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing InsanityGeorgePeterBanyard
 
Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 pramode_ce
 
Little Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinLittle Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinKai Koenig
 
A Sceptical Guide to Functional Programming
A Sceptical Guide to Functional ProgrammingA Sceptical Guide to Functional Programming
A Sceptical Guide to Functional ProgrammingGarth Gilmour
 
Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Fwdays
 
Kotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRreadyKotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRreadyMobileAcademy
 
Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Aaron Gustafson
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsBartosz Kosarzycki
 
What I Love About Ruby
What I Love About RubyWhat I Love About Ruby
What I Love About RubyKeith Bennett
 
Dart, unicorns and rainbows
Dart, unicorns and rainbowsDart, unicorns and rainbows
Dart, unicorns and rainbowschrisbuckett
 

What's hot (20)

IronSmalltalk
IronSmalltalkIronSmalltalk
IronSmalltalk
 
Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...
 
Learning from other's mistakes: Data-driven code analysis
Learning from other's mistakes: Data-driven code analysisLearning from other's mistakes: Data-driven code analysis
Learning from other's mistakes: Data-driven code analysis
 
Codegeneration Goodies
Codegeneration GoodiesCodegeneration Goodies
Codegeneration Goodies
 
Extending the Xbase Typesystem
Extending the Xbase TypesystemExtending the Xbase Typesystem
Extending the Xbase Typesystem
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
 
PHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing InsanityPHP 8: Process & Fixing Insanity
PHP 8: Process & Fixing Insanity
 
Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017 Rust Workshop - NITC FOSSMEET 2017
Rust Workshop - NITC FOSSMEET 2017
 
Little Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinLittle Helpers for Android Development with Kotlin
Little Helpers for Android Development with Kotlin
 
Groovy Programming Language
Groovy Programming LanguageGroovy Programming Language
Groovy Programming Language
 
Iphone course 1
Iphone course 1Iphone course 1
Iphone course 1
 
A Sceptical Guide to Functional Programming
A Sceptical Guide to Functional ProgrammingA Sceptical Guide to Functional Programming
A Sceptical Guide to Functional Programming
 
Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"Nikita Popov "What’s new in PHP 8.0?"
Nikita Popov "What’s new in PHP 8.0?"
 
Kotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRreadyKotlin for Android - Vali Iorgu - mRready
Kotlin for Android - Vali Iorgu - mRready
 
Polyglot JVM
Polyglot JVMPolyglot JVM
Polyglot JVM
 
Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]Fundamental JavaScript [UTC, March 2014]
Fundamental JavaScript [UTC, March 2014]
 
Clean coding-practices
Clean coding-practicesClean coding-practices
Clean coding-practices
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projects
 
What I Love About Ruby
What I Love About RubyWhat I Love About Ruby
What I Love About Ruby
 
Dart, unicorns and rainbows
Dart, unicorns and rainbowsDart, unicorns and rainbows
Dart, unicorns and rainbows
 

Similar to Building DSLs with Xtext - Eclipse Modeling Day 2009

Xtext at Eclipse DemoCamp London in June 2009
Xtext at Eclipse DemoCamp London in June 2009Xtext at Eclipse DemoCamp London in June 2009
Xtext at Eclipse DemoCamp London in June 2009Heiko Behrens
 
C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607Kevin Hazzard
 
Serializing EMF models with Xtext
Serializing EMF models with XtextSerializing EMF models with Xtext
Serializing EMF models with Xtextmeysholdt
 
Modernizes your objective C - Oliviero
Modernizes your objective C - OlivieroModernizes your objective C - Oliviero
Modernizes your objective C - OlivieroCodemotion
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Troy Miles
 
Typescript - why it's awesome
Typescript - why it's awesomeTypescript - why it's awesome
Typescript - why it's awesomePiotr Miazga
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college projectAmitSharma397241
 
AST Transformations
AST TransformationsAST Transformations
AST TransformationsHamletDRC
 
Jsonsaga 100605143125-phpapp02
Jsonsaga 100605143125-phpapp02Jsonsaga 100605143125-phpapp02
Jsonsaga 100605143125-phpapp02Ramamohan Chokkam
 
Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.James Curran
 
Back to the Future with TypeScript
Back to the Future with TypeScriptBack to the Future with TypeScript
Back to the Future with TypeScriptAleš Najmann
 
Building DSLs With Eclipse
Building DSLs With EclipseBuilding DSLs With Eclipse
Building DSLs With EclipsePeter Friese
 
Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)HamletDRC
 

Similar to Building DSLs with Xtext - Eclipse Modeling Day 2009 (20)

Xtext at Eclipse DemoCamp London in June 2009
Xtext at Eclipse DemoCamp London in June 2009Xtext at Eclipse DemoCamp London in June 2009
Xtext at Eclipse DemoCamp London in June 2009
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
ES6 is Nigh
ES6 is NighES6 is Nigh
ES6 is Nigh
 
C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607C# 6 and 7 and Futures 20180607
C# 6 and 7 and Futures 20180607
 
JavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talkJavaScript Neednt Hurt - JavaBin talk
JavaScript Neednt Hurt - JavaBin talk
 
Serializing EMF models with Xtext
Serializing EMF models with XtextSerializing EMF models with Xtext
Serializing EMF models with Xtext
 
Modernizes your objective C - Oliviero
Modernizes your objective C - OlivieroModernizes your objective C - Oliviero
Modernizes your objective C - Oliviero
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
 
Typescript - why it's awesome
Typescript - why it's awesomeTypescript - why it's awesome
Typescript - why it's awesome
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college project
 
Json the-x-in-ajax1588
Json the-x-in-ajax1588Json the-x-in-ajax1588
Json the-x-in-ajax1588
 
AST Transformations
AST TransformationsAST Transformations
AST Transformations
 
Jsonsaga 100605143125-phpapp02
Jsonsaga 100605143125-phpapp02Jsonsaga 100605143125-phpapp02
Jsonsaga 100605143125-phpapp02
 
Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.Build a compiler using C#, Irony and RunSharp.
Build a compiler using C#, Irony and RunSharp.
 
Back to the Future with TypeScript
Back to the Future with TypeScriptBack to the Future with TypeScript
Back to the Future with TypeScript
 
Building DSLs With Eclipse
Building DSLs With EclipseBuilding DSLs With Eclipse
Building DSLs With Eclipse
 
Effective Object Oriented Design in Cpp
Effective Object Oriented Design in CppEffective Object Oriented Design in Cpp
Effective Object Oriented Design in Cpp
 
Day 1
Day 1Day 1
Day 1
 
Java Script Workshop
Java Script WorkshopJava Script Workshop
Java Script Workshop
 
Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)
 

More from Heiko Behrens

beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Webbeyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than WebHeiko Behrens
 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseHeiko Behrens
 
MDSD for iPhone and Android
MDSD for iPhone and AndroidMDSD for iPhone and Android
MDSD for iPhone and AndroidHeiko Behrens
 
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010Heiko Behrens
 
MDSD on iPhone - EclipseCon 2010
MDSD on iPhone - EclipseCon 2010MDSD on iPhone - EclipseCon 2010
MDSD on iPhone - EclipseCon 2010Heiko Behrens
 
iPhonical and model-driven software development for the iPhone
iPhonical and model-driven software development for the iPhoneiPhonical and model-driven software development for the iPhone
iPhonical and model-driven software development for the iPhoneHeiko Behrens
 
Mastering Differentiated MDSD Requirements at Deutsche Boerse AG
Mastering Differentiated MDSD Requirements at Deutsche Boerse AGMastering Differentiated MDSD Requirements at Deutsche Boerse AG
Mastering Differentiated MDSD Requirements at Deutsche Boerse AGHeiko Behrens
 
Xtext - und was man damit anstellen kann
Xtext - und was man damit anstellen kannXtext - und was man damit anstellen kann
Xtext - und was man damit anstellen kannHeiko Behrens
 

More from Heiko Behrens (8)

beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Webbeyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
beyond tellerrand: Mobile Apps with JavaScript – There's More Than Web
 
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with EclipseEclipseCon2011 Cross-Platform Mobile Development with Eclipse
EclipseCon2011 Cross-Platform Mobile Development with Eclipse
 
MDSD for iPhone and Android
MDSD for iPhone and AndroidMDSD for iPhone and Android
MDSD for iPhone and Android
 
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
 
MDSD on iPhone - EclipseCon 2010
MDSD on iPhone - EclipseCon 2010MDSD on iPhone - EclipseCon 2010
MDSD on iPhone - EclipseCon 2010
 
iPhonical and model-driven software development for the iPhone
iPhonical and model-driven software development for the iPhoneiPhonical and model-driven software development for the iPhone
iPhonical and model-driven software development for the iPhone
 
Mastering Differentiated MDSD Requirements at Deutsche Boerse AG
Mastering Differentiated MDSD Requirements at Deutsche Boerse AGMastering Differentiated MDSD Requirements at Deutsche Boerse AG
Mastering Differentiated MDSD Requirements at Deutsche Boerse AG
 
Xtext - und was man damit anstellen kann
Xtext - und was man damit anstellen kannXtext - und was man damit anstellen kann
Xtext - und was man damit anstellen kann
 

Recently uploaded

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
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
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Recently uploaded (20)

Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
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
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

Building DSLs with Xtext - Eclipse Modeling Day 2009

  • 1. Building DSLs with Xtext Eclipse Modeling Day New York, 16 November 2009 Toronto, 18 November 2009 Heiko Behrens (itemis) © itemis AG 2009 – All rights reserved
  • 3.
  • 5.
  • 7. You’d want to core an apple...
  • 8. ... for your kids.
  • 9. ? Right tool for the job?
  • 10. Your trusty swiss army knife!
  • 12. You’d want to core a few more apples...
  • 13. ... for an apple cake.
  • 14. Still the best tool for the job?
  • 17. ... a DSL is ...
  • 18. A specific tool for a specific job
  • 19. A specific tool for a specific job
  • 20. Domain-Specific Language (DSL) A DSL is a formal, processable language targeting at a specific viewpoint or aspect of a software system. Its semantics, flexibility and notation is designed in order to support working with that viewpoint as good as possible.
  • 22. “ Queen to c7. Check.” “ Rd2-c2 , ” rook at d2 moves to c2.
  • 23. Moves in Chess: !ook at a1 moves to a5. P iece S q uare A ction De stin ation "ishop at c8 captures knight at h3. P iece S q uare ion Action D es tinat # b1 x c3 Piece S qua re ction stination AD e $2 - g4 ation S A D quar e ction e stin
  • 24. Rook a1 move a5 Bishop c8 capture h3 Knight Knight b1 capture c3 Queen Pawn g2 move g4 Game Move Source «enum» WhitePlayer * Destination Piece BlackPlayer Piece
  • 25. "ishop at c8 captures knight at h3 " c8 x h3
  • 26. Model (textfile) White: "Mayfield" Black: "Trinks" pawn at e2 moves to e4 pawn at f7 moves to g5 K b1 - c3 f7 - f5 queen at d1 moves to h5 // 1-0
  • 27.
  • 28. Xtext is a complete environment for development of textual - programming languages and - domain-specific languages. It is implemented in Java and is based on Eclipse, EMF, and Antlr.
  • 29. ar Model m m ra G Generator Runtime Superclass Subclass Class LL(*) Parser ecore meta model editor
  • 30. Grammar (similar to EBNF) Game: ! "White:" whitePlayer=STRING ! "Black:" blackPlayer=STRING ! (moves+=Move)+; ! Move: ! AlgebraicMove | SpokenMove; AlgebraicMove: ! (piece=Piece)? source=Square (captures?='x'|'-') dest=Square; ! SpokenMove: ! piece=Piece 'at' source=Square ! (captures?='captures' capturedPiece=Piece 'at' | 'moves to') ! dest=Square; ! terminal Square: ! ('a'..'h')('1'..'8'); ! enum Piece: ! pawn = 'P' | pawn = 'pawn' | ! knight = 'N' | knight = 'knight' | ! bishop = 'B' | bishop = 'bishop' | ! rook = 'R' | rook = 'rook' | ! queen = 'Q' | queen = 'queen' | ! king = 'K' | king = 'king';
  • 31. Demo • Model File within Editor + Custom View • Xtext Grammar for writing simple chess games • Derived meta model • Java program that works with textual models • Xpand-based generator © itemis AG 2009 – All rights reserved 31
  • 36. from FlightBookings F, CarBookings C, HotelBookings H matching [24 hours: F, C, H ] on F.name = C.name = H.name select F.name, true bookingWithCar, into TripleBookings from FlightBookings F, CarBookings C, HotelBookings H matching [24 hours: F, !C, H ] on F.name = C.name = H.name select F.name, false bookingWithCar into TripleBookings from TripleBookings where prev(bookingWithCar) and not bookingWithCar select name into LostCustomers
  • 39. ANT
  • 40. <project name="MyProject" default="dist" basedir="."> <property name="src" location="src"/> <property name="build" location="build"/> <property name="dist" location="dist"/> <target name="init"> <mkdir dir="${build}"/> </target> <target name="compile" depends="init"> <javac srcdir="${src}" destdir="${build}"/> </target> <target name="dist" depends="compile"> <mkdir dir="${dist}/lib"/> <jar jarfile="${dist}/lib/MyProject.jar" basedir="${build}"/> </target> <target name="clean"> <delete dir="${build}"/> <delete dir="${dist}"/> </target> </project>
  • 41. ANT ?
  • 42. <project name="MyProject" default="dist" basedir="."> <property name="src" location="src"/> <property name="build" location="build"/> <property name="dist" location="dist"/> <target name="init"> <mkdir dir="${build}"/> </target> <target name="compile" depends="init"> <javac srcdir="${src}" destdir="${build}"/> </target> <target name="dist" depends="compile"> <mkdir dir="${dist}/lib"/> <jar jarfile="${dist}/lib/MyProject.jar" basedir="${build}"/> </target> <target name="clean"> <delete dir="${build}"/> <delete dir="${dist}"/> </target> </project>
  • 44. package templates; import java.util.*; import java.io.Serializable; import javax.persistence.*; @SuppressWarnings("serial") @Entity public class Customer implements Serializable { ! private Long id; ! private String name; ! private Address address; ! private Set<Order> orders = new HashSet<Order>(); ! // No-arg constructor ! public Customer() { ! } ! @Id ! public Long getId() { ! ! return id; ! } ! public void setId(Long id) { ! ! this.id = id; ! } ! public String getName() { ! ! return name; ! } ! public void setName(String name) { ! ! this.name = name; ! } ! public Address getAddress() { ! ! return address; ! } ! public void setAddress(Address address) { ! ! this.address = address; ! } ! @OneToMany ! public Collection<Order> getOrders() { ! ! return orders; ! } ! public void setOrders(Set<Order> orders) { ! ! this.orders = orders; ! } }
  • 45. package templates; import java.io.Serializable; import java.util.*; import javax.persistence.*; @SuppressWarnings("serial") @Entity public class Customer implements Serializable { ! private Long id; ! private String name; ! private Address address; ! private Set<Order> orders = new HashSet<Order>(); ! // No-arg constructor ! public Customer() { ! } ! @Id ! public Long getId() { ! ! return id; ! } ! public void setId(Long id) { ! ! this.id = id; ! } ! public String getName() { ! ! return name; ! } ! public void setName(String name) { ! ! this.name = name; ! } ! public Address getAddress() { ! ! return address; ! } ! public void setAddress(Address address) { ! ! this.address = address; ! } ! @OneToMany ! public Collection<Order> getOrders() { ! ! return orders; ! } ! public void setOrders(Set<Order> orders) { ! ! this.orders = orders; ! } }
  • 46. entity Customer { ! property name : String ! property address : Address ! property orders : Order[] } POJOs DAOs
  • 48. <entity name="Customer"> <attribute type="String" name="name"/> <findMethod name="findFixed"> <expression> <equals> <attributeRef attr="name"/> <constant val="John Doe"/> </equals> </expression> <findMethod> </entity> entity Customer { ! property name : String ! finder findFixed : name = "John Doe" }
  • 49. Demo ! Implement simple Entity DSL ! Use prepared Generator
  • 50. grammar org.xtext.webinar.Entity ! with org.eclipse.xtext.common.Terminals entity generate entity "http://www.xtext.org/webinar/Entity" Model Model: types ! (elements+=Type)*; * Type: Type name: EString ! SimpleType | Entity; SimpleType: ! 'type' name=ID; SimpleType Entity Entity: extends ! 'entity' name=ID ('extends' extends=[Entity])? '{' properties ! ! properties+=Property* * ! '}'; Property name: EString type many: EBoolean Property: ! 'property' name=ID ':' type=[Type] (many?='[]')?;
  • 51. grammar org.xtext.webinar.Entity ! with org.eclipse.xtext.common.Terminals entity generate entity "http://www.xtext.org/webinar/Entity" Model Model: types ! (elements+=Type)*; * Type: Type name: EString ! SimpleType | Entity; SimpleType: ! 'type' name=ID; SimpleType Entity Entity: extends ! 'entity' name=ID ('extends' extends=[Entity])? '{' properties ! ! properties+=Property* * ! '}'; Property name: EString type many: EBoolean Property: ! 'property' name=ID ':' type=[Type] (many?='[]')?;
  • 52. grammar org.xtext.webinar.Entity ! with org.eclipse.xtext.common.Terminals entity generate entity "http://www.xtext.org/webinar/Entity" Model Model: types ! (elements+=Type)*; * Type: Type name: EString ! SimpleType | Entity; SimpleType: ! 'type' name=ID; SimpleType Entity Entity: extends ! 'entity' name=ID ('extends' extends=[Entity])? '{' properties ! ! properties+=Property* * ! '}'; Property name: EString type many: EBoolean Property: ! 'property' name=ID ':' type=[Type] (many?='[]')?;
  • 53. grammar org.xtext.webinar.Entity ! with org.eclipse.xtext.common.Terminals entity generate entity "http://www.xtext.org/webinar/Entity" Model Model: types ! (elements+=Type)*; * Type: Type name: EString ! SimpleType | Entity; SimpleType: ! 'type' name=ID; SimpleType Entity Entity: extends ! 'entity' name=ID ('extends' extends=[Entity])? '{' properties ! ! properties+=Property* * ! '}'; Property name: EString type many: EBoolean Property: ! 'property' name=ID ':' type=[Type] (many?='[]')?;
  • 54. grammar org.xtext.webinar.Entity ! with org.eclipse.xtext.common.Terminals entity generate entity "http://www.xtext.org/webinar/Entity" Model Model: types ! (elements+=Type)*; * Type: Type name: EString ! SimpleType | Entity; SimpleType: ! 'type' name=ID; SimpleType Entity Entity: extends ! 'entity' name=ID ('extends' extends=[Entity])? '{' properties ! ! properties+=Property* * ! '}'; Property name: EString type many: EBoolean Property: ! 'property' name=ID ':' type=[Type] (many?='[]')?;
  • 55. grammar org.xtext.webinar.Entity ! with org.eclipse.xtext.common.Terminals entity generate entity "http://www.xtext.org/webinar/Entity" Model Model: types ! (elements+=Type)*; * Type: Type name: EString ! SimpleType | Entity; SimpleType: ! 'type' name=ID; SimpleType Entity Entity: extends ! 'entity' name=ID ('extends' extends=[Entity])? '{' properties ! ! properties+=Property* * ! '}'; Property name: EString type many: EBoolean Property: ! 'property' name=ID ':' type=[Type] (many?='[]')?;
  • 56. grammar org.xtext.webinar.Entity ! with org.eclipse.xtext.common.Terminals entity generate entity "http://www.xtext.org/webinar/Entity" Model Model: types ! (elements+=Type)*; * Type: Type name: EString ! SimpleType | Entity; SimpleType: ! 'type' name=ID; SimpleType Entity Entity: extends ! 'entity' name=ID ('extends' extends=[Entity])? '{' properties ! ! properties+=Property* * ! '}'; Property name: EString type many: EBoolean Property: ! 'property' name=ID ':' type=[Type] (many?='[]')?;
  • 58.
  • 63. Use a DSL to develop your tools
  • 65. twitter @HBehrens blog http://HeikoBehrens.net mail Heiko.Behrens@itemis.de xing http://www.xing.com/profile/Heiko_Behrens linkedin http://www.linkedin.com/in/HeikoBehrens www.xtext.org The Committer Team twitter @Xtext Heiko Michael Sven Moritz Peter Dennis Jan Patrick Knut Sebastian Behrens Clay Efftinge Eysholdt Friese Hübner Köhnlein Schönbach Wannheden Zarnekow