DSLs for Java Developers

4,001 views

Published on

Tutorial at EclipseCon 2012, Reston (VA)
with Sebastian Zarnekow

Published in: Technology, News & Politics
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,001
On SlideShare
0
From Embeds
0
Number of Embeds
2,291
Actions
Shares
0
Downloads
26
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

DSLs for Java Developers

  1. 1. How To Install 2.3M6? • Grab one of the USB keys • Install the Eclipse SDK for your platform • Choose File > New > Example... > Eclipse Con 2012 - Xtext TutorialMittwoch, 28. März 12
  2. 2. DSLS FOR JAVA DEVELOPERS Sebastian Zarnekow - Jan Köhnlein (c) itemis - Licensed under EPLMittwoch, 28. März 12
  3. 3. @ ECLIPSECON 2012 Tomorrow • DESAGN - A DSL for engineer-to-order Esa Ryhänen and Martin Nilsson - ERules; AB Sandvik Coromant • Domain Specific Languages Sven Efftinge - itemis • Spraying - a quick way to create Graphitis Karsten Thoms - itemis • Xtext success story at Google Alex Ruiz - Google • Bringing the power of Eclipse to Digital Hardware designers Hendrik Eeckhaut - Sigasi • A Fresh Look at Graphical Editing Jan Köhnlein - itemisMittwoch, 28. März 12
  4. 4. EVEN MORE Wednesday • e(fx)clipse - Eclipse Tooling and Runtime for JavaFX Tom Schindl - bestsolution.at • Program, thou shalt behave! Birgit Engelmann and Sebastian Benz - BMW Car IT • Win Friends and Influence People... with DSLs Vladimir Bacvanski and LloydMangnall - SciSpike; VHA, Inc. • Xcore: Ecore Meets Xtext Ed Merks - itemis Thursday • Eclipse Xtend - A Language Made For Java Developers Sven Efftinge - itemis • Xtext - Best Practices Sebastian Zarnekow - itemisMittwoch, 28. März 12
  5. 5. OUTLINE meta Outline (1) Create a DSL using Xtext (2) Make your DSL refer to Java (3) Get acquainted with the JVM model (4) Map your DSL to Java using Xtend (5) Add expressions to your DSLMittwoch, 28. März 12
  6. 6. DSLs for Java Developers?Mittwoch, 28. März 12
  7. 7. DSLs for Java Developers? import java.util.* package hello.world { entity Person { firstName: String lastName: String friends: List<Person> op getFullName() : String { firstName + + lastName } op sortedFriends() : List<Person> { friends.sortBy [p | p.fullName] } } }Mittwoch, 28. März 12
  8. 8. DSLs for Java Developers? DSL JavaMittwoch, 28. März 12
  9. 9. DSLs for Java Developers? • Use Java’s type system • Use Java libraries, frameworks and code DSL JavaMittwoch, 28. März 12
  10. 10. DSLs for Java Developers? • Use Java’s type system • Use Java libraries, frameworks and code DSL Java • Integrate DSL code into Java application • Execute DSL on JVMMittwoch, 28. März 12
  11. 11. AST DSLMittwoch, 28. März 12
  12. 12. .class AST File DSL .java FileMittwoch, 28. März 12
  13. 13. .class AST File DSL Type Model .java FileMittwoch, 28. März 12
  14. 14. .class AST File DSL Type Model (po int to) .java FileMittwoch, 28. März 12
  15. 15. .class AST File DSL Type Model (po int to) .java File InfrastructureMittwoch, 28. März 12
  16. 16. .class AST File DSL Type Model (po int to) .java File for InfrastructureMittwoch, 28. März 12
  17. 17. .class AST File DSL (po int to) .java FileMittwoch, 28. März 12
  18. 18. .class File AST DSL .java FileMittwoch, 28. März 12
  19. 19. .class File AST Inferred Java Types DSL .java FileMittwoch, 28. März 12
  20. 20. .class File AST Inferred Java Types DSL .java FileMittwoch, 28. März 12
  21. 21. .class File AST Inferred Java Types DSL .java FileMittwoch, 28. März 12
  22. 22. .class File AST Inferred Java Types DSL .java FileMittwoch, 28. März 12
  23. 23. .class File .java DSL File .java FileMittwoch, 28. März 12
  24. 24. .class File .java DSL File .java FileMittwoch, 28. März 12
  25. 25. OUTLINE (1) Create a DSL using Xtext (2) Make your DSL refer to Java (3) Get acquainted with the JVM model (4) Map your DSL to Java using Xtend (5) Add expressions to your DSLMittwoch, 28. März 12
  26. 26. .class File .java DSL File .java FileMittwoch, 28. März 12
  27. 27. .class File .java EXERCISE #1 DSL File .java FileMittwoch, 28. März 12
  28. 28. .class File .java EXERCISE #1 DSL File .java File import types.* package tutorial { entity Person { firstName: String lastName: String } } package types { type String }Mittwoch, 28. März 12
  29. 29. OUTLINE (1) Create a DSL using Xtext (2) Make your DSL refer to Java (3) Get acquainted with the JVM model (4) Map your DSL to Java using Xtend (5) Add expressions to your DSLMittwoch, 28. März 12
  30. 30. .class File .java DSL File .java FileMittwoch, 28. März 12
  31. 31. .class File .java EXERCISE #2 DSL File .java FileMittwoch, 28. März 12
  32. 32. .class File .java EXERCISE #2 DSL File .java File import java.util.* package tutorial { entity Person { firstName: String lastName: String birthday: Date } }Mittwoch, 28. März 12
  33. 33. OUTLINE (1) Create a DSL using Xtext (2) Make your DSL refer to Java (3) Get acquainted with the JVM model (4) Map your DSL to Java using Xtend (5) Add expressions to your DSLMittwoch, 28. März 12
  34. 34. .class File .java DSL File .java FileMittwoch, 28. März 12
  35. 35. .class File .java EXERCISE #3 DSL File .java FileMittwoch, 28. März 12
  36. 36. .class File .java EXERCISE #3 DSL File .java File • Get familiar with the JVM model • Learn about the JvmTypesBuilder • Use Xtend to create a JVM modelMittwoch, 28. März 12
  37. 37. OUTLINE (1) Create a DSL using Xtext (2) Make your DSL refer to Java (3) Get acquainted with the JVM model (4) Map your DSL to Java using Xtend (5) Add expressions to your DSLMittwoch, 28. März 12
  38. 38. .class File .java DSL File .java FileMittwoch, 28. März 12
  39. 39. .class File .java EXERCISE #4 DSL File .java FileMittwoch, 28. März 12
  40. 40. .class File .java EXERCISE #4 DSL File .java File Map your DSL to Java!Mittwoch, 28. März 12
  41. 41. OUTLINE (1) Create a DSL using Xtext (2) Make your DSL refer to Java (3) Get acquainted with the JVM model (4) Map your DSL to Java using Xtend (5) Add expressions to your DSLMittwoch, 28. März 12
  42. 42. .class File .java DSL File .java FileMittwoch, 28. März 12
  43. 43. .class File .java EXERCISE #5 DSL File .java FileMittwoch, 28. März 12
  44. 44. .class File .java EXERCISE #5 DSL File .java File import java.util.* package hello.world { entity Person { firstName: String lastName: String friends: List<Person> op getFullName() : String { firstName + + lastName } op sortedFriends() : List<Person> { friends.sortBy [p | p.fullName] } } }Mittwoch, 28. März 12
  45. 45. Mittwoch, 28. März 12

×