SlideShare une entreprise Scribd logo
1  sur  44
Télécharger pour lire hors ligne
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

Contenu connexe

En vedette

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
 

En vedette (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
 

Similaire à 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
 

Similaire à 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
 

Plus 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
 

Plus 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
 

Dernier

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Dernier (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

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