building dsls with language workbenches
play

building DSLs with language workbenches NEAL FORD software architect - PowerPoint PPT Presentation

Thought Works Thought Works building DSLs with language workbenches NEAL FORD software architect / meme wrangler Thought Works nford@thoughtworks.com 3003 Summit Boulevard, Atlanta, GA 30319 www.nealford.com www.thoughtworks.com


  1. Thought Works Thought Works building DSLs with language workbenches NEAL FORD software architect / meme wrangler Thought Works nford@thoughtworks.com 3003 Summit Boulevard, Atlanta, GA 30319 www.nealford.com www.thoughtworks.com memeagora.blogspot.com

  2. Thought Works

  3. overview language workbenches building grammars or pseudo-grammars generation templates generation using workbench DSLs

  4. language workbenches a tool that supports language oriented programming Intentional Software (Charles Simonyi) Xtext (openArchitectureWare) MPS (JetBrains)

  5. compilation since cs-101 Parse Compile class Foo { private int id; . . . . . . } Editable Representation Executable Storage Representation Representation

  6. “post- ide’s” first java ide to edit the abstract syntax directly enables refactoring

  7. workbenches Versioning Storage class Foo { private int id; . . . . . . } Workbench Projections Document Window Tab Tab Tab Menu Label Executable Editable Representation Text Field Label Representation Storage Representation • Label Label Text Field Text Field Text Field Text Field Text Field Text Field

  8. grammars

  9. Ms. Grant’s secret panel

  10. the DSL events doorClosed D1CL drawOpened D2OP end commands unlockPanel PNUL lockPanel PNLK end

  11. the grammar list : eventList commandList; eventList : 'events' eventDec* 'end'; eventDec : identifier identifier; commandList : 'commands' commandDec* 'end'; commandDec : identifier identifier; events doorClosed D1CL drawOpened D2OP end commands unlockPanel PNUL lockPanel PNLK end

  12. framework/tool for development of external textual DSLs based on openArchitectureWare you provide a grammar in their format Xtext produces: ANTLR grammar, parser, abstract syntax tree meta-model, and Eclipse editor

  13. Xtext project

  14. Xtext artifacts DSL source generated source meta-data for editor plug-in editor plug-in generators

  15. ANTLR grammar

  16. ANTLR grammar . . .

  17. code generation

  18. templates

  19. template file

  20. template

  21. main()

  22. templates

  23. eclipse editor

  24. Xtext most mature of the text-based DSL tools still extricating itself from openArchitectureware & MDA background heavily Eclipse based (editors, project structure, etc.) efficient generation of DSL, grammar, code generation, & templates nice editor projection (acts like source file)

  25. bakery life competition is brutal! incentives to encourage repeat customers... ...but the other guys do the same thing flexible business rules easy to define & change

  26. establishing profiles

  27. discounts

  28. discount

  29. discount implementation

  30. getDiscount()

  31. internal project by JetBrains based on lessons learned with IntelliJ used internally to build new products created by Sergey Dmitriev & Konstantin Solomatov actively used now for 3+ years

  32. new MPS project

  33. concepts fundamental building block like a class: data, behavior, encapsulation also editors, code generators implemented in base language properties, events, methods, and links

  34. concept declaration

  35. concept editor

  36. concept editor

  37. smart help

  38. discount

  39. reduction rule mapping

  40. reduction template

  41. discount template

  42. using the editor

  43. code generation

  44. grammar? encapsulated within

  45. refactoring

  46. find usages

  47. found usages

  48. MPS is written in MPS

  49. composition

  50. composing DSLs

  51. comparisons Xtext MPS Intentional grammar EBNF/antlr encapsulated ? environment Eclipse MPS ? code via MPS or via Eclipse internal generation IntelliJ text-like (for projections EMF & text rich now) project Eclipse MPS ? ecosystem now! soon ? availability open source open source commercial

  52. Thought Works questions? please fill out the session evaluations slides & samples available at nealford.com NEAL FORD software architect / meme wrangler Thought Works This work is licensed under the Creative Commons nford@thoughtworks.com Attribution-Noncommercial-Share Alike 2.5 License. 3003 Summit Boulevard, Atlanta, GA 30319 www.nealford.com www.thoughtworks.com http://creativecommons.org/licenses/by-nc-sa/2.5/ memeagora.blogspot.com

  53. Thought Works resources Xtext http://wiki.eclipse.org/Xtext MPS http://www.jetbrains.com/mps/ Intentional Softare http://www.intentsoft.com/ Martin Fowler’s DSL Work in Progress http://martinfowler.com/dslwip/

Recommend


More recommend