SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
...und was man damit anstellen kann.


               Heiko Behrens
              Eclipse DemoCamp 2009
                Hamburg 25.05.2009


   E-Mail   Heiko.Behrens@itemis.de
            Blog www.1160pm.net
Xtext?
 Xtext is a framework/tool for development of
              external textual DSLs.

       A domain-specific-language (DSL)
            in the context of modeling
        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.
Fuh in VU
 4. und 5.
“Wen hast Du
                 morgen in den
                 letzten beiden
                    Stunden?”


“   Fuh in VU
             ”
     4. und 5.
Aussagen von Phillipp:
Deutsch bei Müller montags in der 1. Stunde
                 kraft
     ch   Fa ehr       agL           deT          Stun
Meierrain Englisch in der 2.de
     k ft
  L
  ehr           ach     F un           St
Sport bei Sippft 3. unde 4.
  Fac
    h      e   L
            hrkr
                 a
                      d
                             S   tun

Sozi in der 5. de
 Fach        n
               Stu
Franz bei Meiert dienstags in der 2.
               kraf
  F cha    ehr L      ag          T         S   t unde

Deutsch 3. unde 4.
  Fac
    h        d
                   S   tun
Montag     Dienstag         Deutsch       Müller
   Deutsch                     Englisch       Meier
   Englisch    Franz
                                Sport         Sipp
    Sport     Deutsch
    Sport     Deutsch           Franz         Meier
     Sozi



  Protokoll          Aussage
Vorname            Lehrkraft                  Stunde
                 * Name                   * Wert
Name
                   Tag
Deutsch bei Müller montags in der 1. Stunde
Grammatik (ähnlich zu EBNF)
Protokoll :
!   quot;Aussagen vonquot; vorname=NAME nachname=NAME quot;:quot;
!   (aussagen+=Aussage)*;
!
Aussage:
!   lehrkraft=NAME quot;inquot; fach=NAME zeit=Zeit |
!   fach=NAME (quot;beiquot; lehrkraft=NAME)? zeit=Zeit;
!
Zeit:
!   (tag=Tag)? stunden+=Stunde ((quot;,quot; | quot;undquot;) stunden+=Stunde)*;
!
Stunde:
!   (quot;inquot; quot;derquot;|quot;zurquot;)? wert=INT quot;.quot; quot;Stundequot;?;
!
enum Tag:
!   unbekannt |
!   montags | dienstags | mittwochs |
!   donnerstags | freitags | samstags;
!
terminal NAME :
!   ('A'..'Z'|'Ä|'Ö'|'Ü') ('A'..'Z'|'Ä'|'Ö'|'Ü'|'-'|'a'..'z'|'ä'|'ö'|'Ü'|'ß')*;
ik
                                        at
Modell




                                      m
                                    m
                               ra
                              G

                         Superclass




                         Subclass              Class




 LL(*) Parser         ecore Metamodell                 Editor
         Xtext-Rahmenwerk (anpassbar mit Google Guice)
Demo


•   Modelldatei
•   Xtext Grammar für Aussagen zum Stundenplan
•   Java-Programm zum Laden und navigieren über Modell
•   Xpand-basierter Generator




© itemis AG 2009 – Alle Rechte vorbehalten               9
Entities (1/2)
@SuppressWarnings(quot;serialquot;)
@Entity
@Table(name = quot;CUSTOMER_INFOquot;)
public class CustomerInfo implements Serializable {

!   @Id
!   @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = quot;idSeqquot;)
!   @SequenceGenerator(name = quot;idSeqquot;, sequenceName = quot;CUST_SEQquot;, allocationSize = 1)
!   @Column(name = quot;CUST_IDquot;, nullable = false)
!   private String customerId;

!   public void setCustomerId(String customerId) {
!   !   this.customerId = customerId;
!   }

!   public String getCustomerId() {
!   !   return customerId;
!   }

!   @Column(name = quot;EMAILquot;, nullable = false, length = 128)
!   private String emailAddress;

!   public String getEmailAddress() {
!   !   return emailAddress;
!   }

!   public void setEmailAddress(String emailAddress) {
!   !   String oldValue = emailAddress;
!   !   this.emailAddress = emailAddress;
!   !   firePropertyChangedEvent(quot;emailAddressquot;, oldValue, this.emailAddress);
!   }
Entities (2/2)


entity CustomerInfo
! (id=CUST_ID, sequenceName=CUST_SEQ) {
!
! String emailAddress (notNull, length = 128)
!
}
DSLs in der Praxis
     Datenmodellierung
  Architekturbeschreibung
        Konfiguration
      Geschäftsregeln
      Dokumentation
          Mapping
Navigation auf Objektgraphen
         Constraints
        Strickmuster
              ...
Language development has never been so easy.
Demo
 Rezept:
 quot;Pizza mit Quark-Ölteigquot;

 Zuaten:
 1 Ei
 2el Öl
 4el Milch
 150g Quark
 260g Mehl
 1x Backpulver

 Arbeitsschritte:
 quot;Einfach alles in die Schüssel
 und umrühren, bis ein fester Teig entsteht.
 Ausrollen, auf Blech legen und belegen.quot;




© itemis AG 2009 – Alle Rechte vorbehalten     16
www.                           .org
       www.twitter.com/xtext

         Downloads
        Documentation
           Support


  Stable Version 0.7 im Juni 2009
    als Teil von Eclipse Galileo

Weitere ähnliche Inhalte

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Xtext - und was man damit anstellen kann

  • 1. ...und was man damit anstellen kann. Heiko Behrens Eclipse DemoCamp 2009 Hamburg 25.05.2009 E-Mail Heiko.Behrens@itemis.de Blog www.1160pm.net
  • 2. Xtext? Xtext is a framework/tool for development of external textual DSLs. A domain-specific-language (DSL) in the context of modeling 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.
  • 3. Fuh in VU 4. und 5.
  • 4. “Wen hast Du morgen in den letzten beiden Stunden?” “ Fuh in VU ” 4. und 5.
  • 5. Aussagen von Phillipp: Deutsch bei Müller montags in der 1. Stunde kraft ch Fa ehr agL deT Stun Meierrain Englisch in der 2.de k ft L ehr ach F un St Sport bei Sippft 3. unde 4. Fac h e L hrkr a d S tun Sozi in der 5. de Fach n Stu Franz bei Meiert dienstags in der 2. kraf F cha ehr L ag T S t unde Deutsch 3. unde 4. Fac h d S tun
  • 6. Montag Dienstag Deutsch Müller Deutsch Englisch Meier Englisch Franz Sport Sipp Sport Deutsch Sport Deutsch Franz Meier Sozi Protokoll Aussage Vorname Lehrkraft Stunde * Name * Wert Name Tag
  • 7. Deutsch bei Müller montags in der 1. Stunde
  • 8. Grammatik (ähnlich zu EBNF) Protokoll : ! quot;Aussagen vonquot; vorname=NAME nachname=NAME quot;:quot; ! (aussagen+=Aussage)*; ! Aussage: ! lehrkraft=NAME quot;inquot; fach=NAME zeit=Zeit | ! fach=NAME (quot;beiquot; lehrkraft=NAME)? zeit=Zeit; ! Zeit: ! (tag=Tag)? stunden+=Stunde ((quot;,quot; | quot;undquot;) stunden+=Stunde)*; ! Stunde: ! (quot;inquot; quot;derquot;|quot;zurquot;)? wert=INT quot;.quot; quot;Stundequot;?; ! enum Tag: ! unbekannt | ! montags | dienstags | mittwochs | ! donnerstags | freitags | samstags; ! terminal NAME : ! ('A'..'Z'|'Ä|'Ö'|'Ü') ('A'..'Z'|'Ä'|'Ö'|'Ü'|'-'|'a'..'z'|'ä'|'ö'|'Ü'|'ß')*;
  • 9. ik at Modell m m ra G Superclass Subclass Class LL(*) Parser ecore Metamodell Editor Xtext-Rahmenwerk (anpassbar mit Google Guice)
  • 10. Demo • Modelldatei • Xtext Grammar für Aussagen zum Stundenplan • Java-Programm zum Laden und navigieren über Modell • Xpand-basierter Generator © itemis AG 2009 – Alle Rechte vorbehalten 9
  • 11. Entities (1/2) @SuppressWarnings(quot;serialquot;) @Entity @Table(name = quot;CUSTOMER_INFOquot;) public class CustomerInfo implements Serializable { ! @Id ! @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = quot;idSeqquot;) ! @SequenceGenerator(name = quot;idSeqquot;, sequenceName = quot;CUST_SEQquot;, allocationSize = 1) ! @Column(name = quot;CUST_IDquot;, nullable = false) ! private String customerId; ! public void setCustomerId(String customerId) { ! ! this.customerId = customerId; ! } ! public String getCustomerId() { ! ! return customerId; ! } ! @Column(name = quot;EMAILquot;, nullable = false, length = 128) ! private String emailAddress; ! public String getEmailAddress() { ! ! return emailAddress; ! } ! public void setEmailAddress(String emailAddress) { ! ! String oldValue = emailAddress; ! ! this.emailAddress = emailAddress; ! ! firePropertyChangedEvent(quot;emailAddressquot;, oldValue, this.emailAddress); ! }
  • 12. Entities (2/2) entity CustomerInfo ! (id=CUST_ID, sequenceName=CUST_SEQ) { ! ! String emailAddress (notNull, length = 128) ! }
  • 13. DSLs in der Praxis Datenmodellierung Architekturbeschreibung Konfiguration Geschäftsregeln Dokumentation Mapping Navigation auf Objektgraphen Constraints Strickmuster ...
  • 14. Language development has never been so easy.
  • 15.
  • 16.
  • 17. Demo Rezept: quot;Pizza mit Quark-Ölteigquot; Zuaten: 1 Ei 2el Öl 4el Milch 150g Quark 260g Mehl 1x Backpulver Arbeitsschritte: quot;Einfach alles in die Schüssel und umrühren, bis ein fester Teig entsteht. Ausrollen, auf Blech legen und belegen.quot; © itemis AG 2009 – Alle Rechte vorbehalten 16
  • 18. www. .org www.twitter.com/xtext Downloads Documentation Support Stable Version 0.7 im Juni 2009 als Teil von Eclipse Galileo