Xtext @ Profict Summer Camp

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Group

    Xtext @ Profict Summer Camp - Presentation Transcript

    1. Domain-Specific Languages with Sven Efftinge copyright 2008 by itemis AG
    2. Kiel, Germany
    3. Jan Peter Dennis
    4. “... won’t talk about model-driven stuff”
    5. You’re lucky!
    6. No UML!
    7. No MDA! No meta meta meta meta ...
    8. Hands-on a concrete example taken from Martin Fowler’s upcoming Book on DSLs
    9. You’re working for a company specialized on systems for secret compartments
    10. Your customer: Mrs. H she likes secrets
    11. To open the secret compartment, she has to
    12. To open the secret compartment, she has to close the door,
    13. To open the secret compartment, she has to close the door, open the second draw in her chest,
    14. To open the secret compartment, she has to close the door, open the second draw in her chest, turn her bedside light on.
    15. 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
    16. 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
    17. 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
    18. On top of external DSLs no compromises
    19. On top of external DSLs no compromises domain-specific static analysis
    20. On top of external DSLs no compromises domain-specific static analysis graphical views
    21. On top of external DSLs no compromises domain-specific static analysis graphical views closed scope
    22. Implementing an external DSL is complicated
    23. Why not using a DSL ... ... to develop DSLs?
    24. 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];
    25. 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];
    26. 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];
    27. 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];
    28. 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];
    29. 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];
    30. 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];
    31. 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];
    32. This was the example DSL implemented in So what do we get from such a description?
    33. Antlr based Parser
    34. Antlr based Parser Eclipse based Editor
    35. 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
    36. Demo
    37. oaw.itemis.com Thank you very much! the eclipse distro can be downloaded from http://oaw.itemis.com

    + Sven EfftingeSven Efftinge, 2 years ago

    custom

    888 views, 0 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 888
      • 888 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 19
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Groups / Events