SlideShare uma empresa Scribd logo
1 de 44
Baixar para ler offline
Domain-Specific Languages with


                              Sven Efftinge




copyright 2008 by itemis AG
Kiel, Germany
Jan   Peter




         Dennis
“... won’t talk
     about
model-driven
     stuff”
You’re lucky!
No UML!
No MDA!




No meta meta
meta meta ...
Hands-on a

concrete example
taken from Martin Fowler’s upcoming
         Book on DSLs
You’re working for a company
   specialized on systems for
secret compartments
Your customer:
Mrs. H
she likes secrets
To open the secret compartment, she has to
To open the secret compartment, she has to

               close the door,
To open the secret compartment, she has to

               close the door,

  open the second draw in
               her chest,
To open the secret compartment, she has to

                close the door,

  open the second draw in
                her chest,


turn her bedside light on.
events
 doorClosed
 drawOpened
 lightOn
 doorOpened
 panelClosed
end

resetEvents
 doorOpened
end

commands
 unlockPanel
 lockPanel
 lockDoor
 unlockDoor
end

state idle
 actions {unlockDoor lockPanel}
 doorClosed => active
end

state active
 drawOpened => waitingForLight
 lightOn => waitingForDraw
end

state waitingForLight
 lightOn => unlockedPanel
end

state waitingForDraw
 drawOpened => unlockedPanel
end

state unlockedPanel
 actions {unlockPanel lockDoor}
 panelClosed => idle
end
External DSL                      Internal DSL
events                            event :doorClosed
 doorClosed                       event :drawOpened
 drawOpened
                                  event :lightOn
 lightOn
 doorOpened                       event :doorOpened
 panelClosed                      event :panelClosed
end
                                  command    :unlockPanel
resetEvents                       command    :lockPanel
 doorOpened
end                               command    :lockDoor
                                  command    :unlockDoor
commands
 unlockPanel                      resetEvents :doorOpened
 lockPanel
 lockDoor
 unlockDoor
                                  state :idle do
end                                 actions :unlockDoor, :lockPanel
                                    transitions :doorClosed => :active
state idle                        end
 actions {unlockDoor lockPanel}
 doorClosed => active
                                  state :active do
end
                                    transitions :drawOpened => :waitingForLight,
state active                                 :lightOn => :waitingForDraw
 drawOpened => waitingForLight    end
 lightOn => waitingForDraw
end                               state :waitingForLight do
state waitingForLight               transitions :lightOn => :unlockedPanel
 lightOn => unlockedPanel         end
end
                                  state :waitingForDraw do
state waitingForDraw                transitions :drawOpened => :unlockedPanel
 drawOpened => unlockedPanel
end
                                  end

state unlockedPanel               state :unlockedPanel do
 actions {unlockPanel lockDoor}     actions :unlockPanel, :lockDoor
 panelClosed => idle                transitions :panelClosed => :idle
end
                                  end
External DSL                      Internal DSL
events                            event :doorClosed
 doorClosed                       event :drawOpened
 drawOpened                       event :lightOn
 lightOn
 doorOpened                       event :doorOpened
 panelClosed                      event :panelClosed
end
                                  command :unlockPanel
resetEvents                       command :lockPanel
 doorOpened
end                               command :lockDoor
                                  command :unlockDoor
commands
 unlockPanel                      resetEvents :doorOpened
 lockPanel
 lockDoor
 unlockDoor
                                  state :idle do
end                                 actions :unlockDoor, :lockPanel
                                    transitions :doorClosed => :active
state idle                        end
 actions {unlockDoor lockPanel}
 doorClosed => active
                                  state :active do
end
                                    transitions :drawOpened => :waitingForLight,
state active                                 :lightOn => :waitingForDraw
 drawOpened => waitingForLight    end
 lightOn => waitingForDraw
end                               state :waitingForLight do
state waitingForLight               transitions :lightOn => :unlockedPanel
 lightOn => unlockedPanel         end
end
                                  state :waitingForDraw do
state waitingForDraw                transitions :drawOpened => :unlockedPanel
 drawOpened => unlockedPanel
end                               end

state unlockedPanel               state :unlockedPanel do
 actions {unlockPanel lockDoor}     actions :unlockPanel, :lockDoor
 panelClosed => idle                transitions :panelClosed => :idle
end
                                  end
On top of external DSLs
no compromises
On top of external DSLs
no compromises
domain-specific static analysis
On top of external DSLs
no compromises
domain-specific static analysis
graphical views
On top of external DSLs
no compromises
domain-specific static analysis
graphical views
closed scope
Implementing an
external DSL
is
complicated
Why not using a DSL ...




... to develop DSLs?
Statemachine :
	 'events'
	 	 (events+=Event)+
	 'end'
	 'resetEvents'
	 	 (resetEvents+=[Event])+
	 'end'
	 'commands'
	 	 (commands+=Command)+
	 'end'
	 (states+=State)+;
	
Event :
	 name=ID;
	
Command :
	 name=ID;
	
State :
	 'state' name=ID
	 ('actions' '{' (actions+=[Command])+ '}')?
	 (transitions+=Transition)*
	 'end';
	
Transition :
	 event=[Event] '=>' state=[State];
Statemachine :
	 'events'
	 	 (events+=Event)+
	 'end'
	 'resetEvents'
                                        starts with keyword ‘events’
	 	 (resetEvents+=[Event])+
	 'end'
	 'commands'
	 	 (commands+=Command)+
	 'end'
	 (states+=State)+;
	
Event :
	 name=ID;
	
Command :
	 name=ID;
	
State :
	 'state' name=ID
	 ('actions' '{' (actions+=[Command])+ '}')?
	 (transitions+=Transition)*
	 'end';
	
Transition :
	 event=[Event] '=>' state=[State];
Statemachine :
	 'events'
	 	 (events+=Event)+
	 'end'
	 'resetEvents'                            followed by at least one
	 	 (resetEvents+=[Event])+
	 'end'                                        definition of Event
	 'commands'
	 	 (commands+=Command)+
	 'end'
	 (states+=State)+;
	
Event :
	 name=ID;
	
                                        which is defined here and
Command :
	 name=ID;
                                          consists of just one
	                                            identifier (ID)
State :
	 'state' name=ID
	 ('actions' '{' (actions+=[Command])+ '}')?
	 (transitions+=Transition)*
	 'end';
	
Transition :
	 event=[Event] '=>' state=[State];
Statemachine :
	 'events'
	 	 (events+=Event)+
	 'end'
	 'resetEvents'
	 	 (resetEvents+=[Event])+
	 'end'
	 'commands'
	 	 (commands+=Command)+
	 'end'
	 (states+=State)+;                      this is a cross reference,
	
Event :                                     referencing Events
	 name=ID;
	                                        declared in the previous
Command :
	 name=ID;                                         section.
	
State :
	 'state' name=ID
	 ('actions' '{' (actions+=[Command])+ '}')?
	 (transitions+=Transition)*
	 'end';
	
Transition :
	 event=[Event] '=>' state=[State];
Statemachine :
	 'events'
	 	 (events+=Event)+
	 'end'
	 'resetEvents'
	 	 (resetEvents+=[Event])+
	 'end'
	 'commands'
	 	 (commands+=Command)+
	 'end'
	 (states+=State)+;
	
Event :
	 name=ID;
                                               commands are very
	
Command :
                                                similar to events
	 name=ID;
	
State :
	 'state' name=ID
	 ('actions' '{' (actions+=[Command])+ '}')?
	 (transitions+=Transition)*
	 'end';
	
Transition :
	 event=[Event] '=>' state=[State];
Statemachine :
	 'events'
	 	 (events+=Event)+
	 'end'
	 'resetEvents'
	 	 (resetEvents+=[Event])+
	 'end'
	 'commands'
	 	 (commands+=Command)+
	 'end'
	 (states+=State)+;
	
Event :                                  States have a name (ID)
	 name=ID;
	
Command :
	 name=ID;
	
State :
	 'state' name=ID
	 ('actions' '{' (actions+=[Command])+ '}')?
	 (transitions+=Transition)*
	 'end';
	
Transition :
	 event=[Event] '=>' state=[State];
Statemachine :
	 'events'
	 	 (events+=Event)+
	 'end'
	 'resetEvents'
	 	 (resetEvents+=[Event])+
	 'end'
	 'commands'
	 	 (commands+=Command)+
	 'end'
	 (states+=State)+;
	
Event :                                  States have a name (ID)
	 name=ID;
	
Command :
	 name=ID;
	                                              optional action block
State :
	 'state' name=ID
	 ('actions' '{' (actions+=[Command])+ '}')?
	 (transitions+=Transition)*
	 'end';
	
Transition :
	 event=[Event] '=>' state=[State];
Statemachine :
	 'events'
	 	 (events+=Event)+
	 'end'
	 'resetEvents'
	 	 (resetEvents+=[Event])+
	 'end'
	 'commands'
	 	 (commands+=Command)+
	 'end'
	 (states+=State)+;
	
Event :                                  States have a name (ID)
	 name=ID;
	
Command :
	 name=ID;
	                                               optional action block
State :
	 'state' name=ID
	 ('actions' '{' (actions+=[Command])+ '}')?
	 (transitions+=Transition)*
	 'end';
	
Transition :
                                               any number of Transitions
	 event=[Event] '=>' state=[State];
This was the example DSL
       implemented in



So what do we get from such a
         description?
Antlr based Parser
Antlr based Parser




Eclipse based Editor
Antlr based Parser




                            Eclipse based Editor
                                          Statemachine




commands                                                           * events
              *                 resetStates     * states
  Command                                    State              Event
name:String       *                       name:String        name:String
                      actions
                                  state
                                                           event



                                                                              EMF based Semantic Model
                                                *
                                           Transition
Demo
oaw.itemis.com
    Thank you very much!
the eclipse distro can be downloaded from

http://oaw.itemis.com

Mais conteúdo relacionado

Destaque

X:\ticd2010\carmen\ffagreen 1
X:\ticd2010\carmen\ffagreen 1X:\ticd2010\carmen\ffagreen 1
X:\ticd2010\carmen\ffagreen 1calpez
 
E N A B L I N G V I R T U A L I Z E D G RI D S W I T H O R A C L E A...
E N A B L I N G   V I R T U A L I Z E D   G RI D S   W I T H   O R A C L E  A...E N A B L I N G   V I R T U A L I Z E D   G RI D S   W I T H   O R A C L E  A...
E N A B L I N G V I R T U A L I Z E D G RI D S W I T H O R A C L E A...Frank Martin
 
Xtenza new profile 2013
Xtenza new profile 2013Xtenza new profile 2013
Xtenza new profile 2013Vel Muruga
 
Xthobil relatoria 30_de_enero
Xthobil relatoria 30_de_eneroXthobil relatoria 30_de_enero
Xthobil relatoria 30_de_eneroSEP
 

Destaque (6)

Xterra
XterraXterra
Xterra
 
Xtian art forms
Xtian art formsXtian art forms
Xtian art forms
 
X:\ticd2010\carmen\ffagreen 1
X:\ticd2010\carmen\ffagreen 1X:\ticd2010\carmen\ffagreen 1
X:\ticd2010\carmen\ffagreen 1
 
E N A B L I N G V I R T U A L I Z E D G RI D S W I T H O R A C L E A...
E N A B L I N G   V I R T U A L I Z E D   G RI D S   W I T H   O R A C L E  A...E N A B L I N G   V I R T U A L I Z E D   G RI D S   W I T H   O R A C L E  A...
E N A B L I N G V I R T U A L I Z E D G RI D S W I T H O R A C L E A...
 
Xtenza new profile 2013
Xtenza new profile 2013Xtenza new profile 2013
Xtenza new profile 2013
 
Xthobil relatoria 30_de_enero
Xthobil relatoria 30_de_eneroXthobil relatoria 30_de_enero
Xthobil relatoria 30_de_enero
 

Semelhante a Xtext @ Profict Summer Camp

Concurrent applications with free monads and stm
Concurrent applications with free monads and stmConcurrent applications with free monads and stm
Concurrent applications with free monads and stmAlexander Granin
 
jQuery : Events are where it happens!
jQuery : Events are where it happens!jQuery : Events are where it happens!
jQuery : Events are where it happens!Wildan Maulana
 
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docxjava compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docxpriestmanmable
 
Yahoo presentation: JavaScript Events
Yahoo presentation: JavaScript EventsYahoo presentation: JavaScript Events
Yahoo presentation: JavaScript EventsPeter-Paul Koch
 
Coroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth reviewCoroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth reviewDmytro Zaitsev
 
Writing Modular Command-line Apps with App::Cmd
Writing Modular Command-line Apps with App::CmdWriting Modular Command-line Apps with App::Cmd
Writing Modular Command-line Apps with App::CmdRicardo Signes
 
Introduction to State Machines
Introduction to State MachinesIntroduction to State Machines
Introduction to State Machinescodeofficer
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript FunctionsColin DeCarlo
 
Javascript Experiment
Javascript ExperimentJavascript Experiment
Javascript Experimentwgamboa
 
Simulation structure - Part 2
Simulation structure - Part 2Simulation structure - Part 2
Simulation structure - Part 2guticr
 
How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...Gosuke Miyashita
 

Semelhante a Xtext @ Profict Summer Camp (18)

HEAD FIRST DSL
HEAD FIRST DSLHEAD FIRST DSL
HEAD FIRST DSL
 
Concurrent applications with free monads and stm
Concurrent applications with free monads and stmConcurrent applications with free monads and stm
Concurrent applications with free monads and stm
 
DHow2 - L6 VHDL
DHow2 - L6 VHDLDHow2 - L6 VHDL
DHow2 - L6 VHDL
 
MUST CS101 Lab11
MUST CS101 Lab11 MUST CS101 Lab11
MUST CS101 Lab11
 
Presentation1
Presentation1Presentation1
Presentation1
 
jQuery : Events are where it happens!
jQuery : Events are where it happens!jQuery : Events are where it happens!
jQuery : Events are where it happens!
 
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docxjava compilerCompiler1.javajava compilerCompiler1.javaimport.docx
java compilerCompiler1.javajava compilerCompiler1.javaimport.docx
 
Yahoo presentation: JavaScript Events
Yahoo presentation: JavaScript EventsYahoo presentation: JavaScript Events
Yahoo presentation: JavaScript Events
 
Coroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth reviewCoroutines in Kotlin. In-depth review
Coroutines in Kotlin. In-depth review
 
Writing Modular Command-line Apps with App::Cmd
Writing Modular Command-line Apps with App::CmdWriting Modular Command-line Apps with App::Cmd
Writing Modular Command-line Apps with App::Cmd
 
Introduction to State Machines
Introduction to State MachinesIntroduction to State Machines
Introduction to State Machines
 
JavaScript Functions
JavaScript FunctionsJavaScript Functions
JavaScript Functions
 
Deferred
DeferredDeferred
Deferred
 
Javascript Experiment
Javascript ExperimentJavascript Experiment
Javascript Experiment
 
Verilog_Examples (1).pdf
Verilog_Examples (1).pdfVerilog_Examples (1).pdf
Verilog_Examples (1).pdf
 
Simulation structure - Part 2
Simulation structure - Part 2Simulation structure - Part 2
Simulation structure - Part 2
 
How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...
 
Rts
RtsRts
Rts
 

Mais de Sven Efftinge

Parsing Expression With Xtext
Parsing Expression With XtextParsing Expression With Xtext
Parsing Expression With XtextSven Efftinge
 
Language Engineering With Xtext
Language Engineering With XtextLanguage Engineering With Xtext
Language Engineering With XtextSven Efftinge
 
Auto-GWT : Better GWT Programming with Xtend
Auto-GWT : Better GWT Programming with XtendAuto-GWT : Better GWT Programming with Xtend
Auto-GWT : Better GWT Programming with XtendSven Efftinge
 
Functional programming with Xtend
Functional programming with XtendFunctional programming with Xtend
Functional programming with XtendSven Efftinge
 
Codegeneration With Xtend
Codegeneration With XtendCodegeneration With Xtend
Codegeneration With XtendSven Efftinge
 
Domain Specific Languages (EclipseCon 2012)
Domain Specific Languages (EclipseCon 2012)Domain Specific Languages (EclipseCon 2012)
Domain Specific Languages (EclipseCon 2012)Sven Efftinge
 
Xtend @ EclipseCon 2012
Xtend @ EclipseCon 2012Xtend @ EclipseCon 2012
Xtend @ EclipseCon 2012Sven Efftinge
 
This Is Not Your Father's Java
This Is Not Your Father's JavaThis Is Not Your Father's Java
This Is Not Your Father's JavaSven Efftinge
 
Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]Sven Efftinge
 
Xtext at MDD Day 2010
Xtext at MDD Day 2010Xtext at MDD Day 2010
Xtext at MDD Day 2010Sven Efftinge
 
Dependency Injection for Eclipse developers
Dependency Injection for Eclipse developersDependency Injection for Eclipse developers
Dependency Injection for Eclipse developersSven Efftinge
 
Challenges In Dsl Design
Challenges In Dsl DesignChallenges In Dsl Design
Challenges In Dsl DesignSven Efftinge
 
Code Generation in Agile Projects
Code Generation in Agile ProjectsCode Generation in Agile Projects
Code Generation in Agile ProjectsSven Efftinge
 

Mais de Sven Efftinge (20)

Parsing Expression With Xtext
Parsing Expression With XtextParsing Expression With Xtext
Parsing Expression With Xtext
 
Language Engineering With Xtext
Language Engineering With XtextLanguage Engineering With Xtext
Language Engineering With Xtext
 
Future of Xtext
Future of XtextFuture of Xtext
Future of Xtext
 
Auto-GWT : Better GWT Programming with Xtend
Auto-GWT : Better GWT Programming with XtendAuto-GWT : Better GWT Programming with Xtend
Auto-GWT : Better GWT Programming with Xtend
 
Functional programming with Xtend
Functional programming with XtendFunctional programming with Xtend
Functional programming with Xtend
 
Codegeneration With Xtend
Codegeneration With XtendCodegeneration With Xtend
Codegeneration With Xtend
 
Gwt and Xtend
Gwt and XtendGwt and Xtend
Gwt and Xtend
 
Domain Specific Languages (EclipseCon 2012)
Domain Specific Languages (EclipseCon 2012)Domain Specific Languages (EclipseCon 2012)
Domain Specific Languages (EclipseCon 2012)
 
Xtend @ EclipseCon 2012
Xtend @ EclipseCon 2012Xtend @ EclipseCon 2012
Xtend @ EclipseCon 2012
 
Eclipse Xtend
Eclipse XtendEclipse Xtend
Eclipse Xtend
 
This Is Not Your Father's Java
This Is Not Your Father's JavaThis Is Not Your Father's Java
This Is Not Your Father's Java
 
Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]Getting the most out of Java [Nordic Coding-2010]
Getting the most out of Java [Nordic Coding-2010]
 
Xtext at MDD Day 2010
Xtext at MDD Day 2010Xtext at MDD Day 2010
Xtext at MDD Day 2010
 
Dependency Injection for Eclipse developers
Dependency Injection for Eclipse developersDependency Injection for Eclipse developers
Dependency Injection for Eclipse developers
 
Xtext Webinar
Xtext WebinarXtext Webinar
Xtext Webinar
 
Challenges In Dsl Design
Challenges In Dsl DesignChallenges In Dsl Design
Challenges In Dsl Design
 
Code Generation in Agile Projects
Code Generation in Agile ProjectsCode Generation in Agile Projects
Code Generation in Agile Projects
 
Xtext Eclipse Con
Xtext Eclipse ConXtext Eclipse Con
Xtext Eclipse Con
 
Generic Editor
Generic EditorGeneric Editor
Generic Editor
 
Eclipse Banking Day
Eclipse Banking DayEclipse Banking Day
Eclipse Banking Day
 

Último

So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
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
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
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
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 

Último (20)

So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
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...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
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...
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 

Xtext @ Profict Summer Camp

  • 1. Domain-Specific Languages with Sven Efftinge copyright 2008 by itemis AG
  • 3.
  • 4. Jan Peter Dennis
  • 5.
  • 6.
  • 7.
  • 8. “... won’t talk about model-driven stuff”
  • 11. No MDA! No meta meta meta meta ...
  • 12.
  • 13. Hands-on a concrete example taken from Martin Fowler’s upcoming Book on DSLs
  • 14. You’re working for a company specialized on systems for secret compartments
  • 15. Your customer: Mrs. H she likes secrets
  • 16. To open the secret compartment, she has to
  • 17. To open the secret compartment, she has to close the door,
  • 18. To open the secret compartment, she has to close the door, open the second draw in her chest,
  • 19. To open the secret compartment, she has to close the door, open the second draw in her chest, turn her bedside light on.
  • 20. events doorClosed drawOpened lightOn doorOpened panelClosed end resetEvents doorOpened end commands unlockPanel lockPanel lockDoor unlockDoor end state idle actions {unlockDoor lockPanel} doorClosed => active end state active drawOpened => waitingForLight lightOn => waitingForDraw end state waitingForLight lightOn => unlockedPanel end state waitingForDraw drawOpened => unlockedPanel end state unlockedPanel actions {unlockPanel lockDoor} panelClosed => idle end
  • 21. External DSL Internal DSL events event :doorClosed doorClosed event :drawOpened drawOpened event :lightOn lightOn doorOpened event :doorOpened panelClosed event :panelClosed end command :unlockPanel resetEvents command :lockPanel doorOpened end command :lockDoor command :unlockDoor commands unlockPanel resetEvents :doorOpened lockPanel lockDoor unlockDoor state :idle do end actions :unlockDoor, :lockPanel transitions :doorClosed => :active state idle end actions {unlockDoor lockPanel} doorClosed => active state :active do end transitions :drawOpened => :waitingForLight, state active :lightOn => :waitingForDraw drawOpened => waitingForLight end lightOn => waitingForDraw end state :waitingForLight do state waitingForLight transitions :lightOn => :unlockedPanel lightOn => unlockedPanel end end state :waitingForDraw do state waitingForDraw transitions :drawOpened => :unlockedPanel drawOpened => unlockedPanel end end state unlockedPanel state :unlockedPanel do actions {unlockPanel lockDoor} actions :unlockPanel, :lockDoor panelClosed => idle transitions :panelClosed => :idle end end
  • 22. External DSL Internal DSL events event :doorClosed doorClosed event :drawOpened drawOpened event :lightOn lightOn doorOpened event :doorOpened panelClosed event :panelClosed end command :unlockPanel resetEvents command :lockPanel doorOpened end command :lockDoor command :unlockDoor commands unlockPanel resetEvents :doorOpened lockPanel lockDoor unlockDoor state :idle do end actions :unlockDoor, :lockPanel transitions :doorClosed => :active state idle end actions {unlockDoor lockPanel} doorClosed => active state :active do end transitions :drawOpened => :waitingForLight, state active :lightOn => :waitingForDraw drawOpened => waitingForLight end lightOn => waitingForDraw end state :waitingForLight do state waitingForLight transitions :lightOn => :unlockedPanel lightOn => unlockedPanel end end state :waitingForDraw do state waitingForDraw transitions :drawOpened => :unlockedPanel drawOpened => unlockedPanel end end state unlockedPanel state :unlockedPanel do actions {unlockPanel lockDoor} actions :unlockPanel, :lockDoor panelClosed => idle transitions :panelClosed => :idle end end
  • 23. On top of external DSLs no compromises
  • 24. On top of external DSLs no compromises domain-specific static analysis
  • 25. On top of external DSLs no compromises domain-specific static analysis graphical views
  • 26. On top of external DSLs no compromises domain-specific static analysis graphical views closed scope
  • 28.
  • 29. Why not using a DSL ... ... to develop DSLs?
  • 30. Statemachine : 'events' (events+=Event)+ 'end' 'resetEvents' (resetEvents+=[Event])+ 'end' 'commands' (commands+=Command)+ 'end' (states+=State)+; Event : name=ID; Command : name=ID; State : 'state' name=ID ('actions' '{' (actions+=[Command])+ '}')? (transitions+=Transition)* 'end'; Transition : event=[Event] '=>' state=[State];
  • 31. Statemachine : 'events' (events+=Event)+ 'end' 'resetEvents' starts with keyword ‘events’ (resetEvents+=[Event])+ 'end' 'commands' (commands+=Command)+ 'end' (states+=State)+; Event : name=ID; Command : name=ID; State : 'state' name=ID ('actions' '{' (actions+=[Command])+ '}')? (transitions+=Transition)* 'end'; Transition : event=[Event] '=>' state=[State];
  • 32. Statemachine : 'events' (events+=Event)+ 'end' 'resetEvents' followed by at least one (resetEvents+=[Event])+ 'end' definition of Event 'commands' (commands+=Command)+ 'end' (states+=State)+; Event : name=ID; which is defined here and Command : name=ID; consists of just one identifier (ID) State : 'state' name=ID ('actions' '{' (actions+=[Command])+ '}')? (transitions+=Transition)* 'end'; Transition : event=[Event] '=>' state=[State];
  • 33. Statemachine : 'events' (events+=Event)+ 'end' 'resetEvents' (resetEvents+=[Event])+ 'end' 'commands' (commands+=Command)+ 'end' (states+=State)+; this is a cross reference, Event : referencing Events name=ID; declared in the previous Command : name=ID; section. State : 'state' name=ID ('actions' '{' (actions+=[Command])+ '}')? (transitions+=Transition)* 'end'; Transition : event=[Event] '=>' state=[State];
  • 34. Statemachine : 'events' (events+=Event)+ 'end' 'resetEvents' (resetEvents+=[Event])+ 'end' 'commands' (commands+=Command)+ 'end' (states+=State)+; Event : name=ID; commands are very Command : similar to events name=ID; State : 'state' name=ID ('actions' '{' (actions+=[Command])+ '}')? (transitions+=Transition)* 'end'; Transition : event=[Event] '=>' state=[State];
  • 35. Statemachine : 'events' (events+=Event)+ 'end' 'resetEvents' (resetEvents+=[Event])+ 'end' 'commands' (commands+=Command)+ 'end' (states+=State)+; Event : States have a name (ID) name=ID; Command : name=ID; State : 'state' name=ID ('actions' '{' (actions+=[Command])+ '}')? (transitions+=Transition)* 'end'; Transition : event=[Event] '=>' state=[State];
  • 36. Statemachine : 'events' (events+=Event)+ 'end' 'resetEvents' (resetEvents+=[Event])+ 'end' 'commands' (commands+=Command)+ 'end' (states+=State)+; Event : States have a name (ID) name=ID; Command : name=ID; optional action block State : 'state' name=ID ('actions' '{' (actions+=[Command])+ '}')? (transitions+=Transition)* 'end'; Transition : event=[Event] '=>' state=[State];
  • 37. Statemachine : 'events' (events+=Event)+ 'end' 'resetEvents' (resetEvents+=[Event])+ 'end' 'commands' (commands+=Command)+ 'end' (states+=State)+; Event : States have a name (ID) name=ID; Command : name=ID; optional action block State : 'state' name=ID ('actions' '{' (actions+=[Command])+ '}')? (transitions+=Transition)* 'end'; Transition : any number of Transitions event=[Event] '=>' state=[State];
  • 38. This was the example DSL implemented in So what do we get from such a description?
  • 39.
  • 42. Antlr based Parser Eclipse based Editor Statemachine commands * events * resetStates * states Command State Event name:String * name:String name:String actions state event EMF based Semantic Model * Transition
  • 43. Demo
  • 44. oaw.itemis.com Thank you very much! the eclipse distro can be downloaded from http://oaw.itemis.com