1 / 28

Building DSLs with Eclipse

Building DSLs with Eclipse. Peter Friese, itemis @peterfriese @xtext. (c) 2009 Peter Friese. Distributed under the EDL V1.0 - http://www.eclipse.org/org/documents/edl-v10.php More info: http://www.peterfriese.de / http://www.itemis.co m. Suppose. You’d want to core an apple.

afric
Download Presentation

Building DSLs with Eclipse

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Building DSLs with Eclipse • Peter Friese, itemis • @peterfriese • @xtext (c) 2009 Peter Friese. Distributed under the EDL V1.0 - http://www.eclipse.org/org/documents/edl-v10.php More info: http://www.peterfriese.de / http://www.itemis.com

  2. Suppose...

  3. You’d want to core an apple...

  4. ... for your kids.

  5. ? Right tool for the job?

  6. Your trusty swiss army knife!

  7. Because you can use it for other stuff, too. E.g., opening a bottle of wine.

  8. Suppose...

  9. You’d want to core a few more apples...

  10. ... for an apple cake.

  11. Still the best tool for the job?

  12. Better use this one.

  13. and this one:

  14. BUT avoid the unitasker!

  15. ... a DSL is ...

  16. A specific tool for a specific job

  17. A specific tool for a specific job

  18. Samples for DSLs

  19. SQL

  20. select name, salary from employees where salary > 2000 order by salary

  21. ANT

  22. <project name="MyProject" default="dist" basedir="."> <property name="src" location="src"/> <property name="build" location="build"/> <property name="dist" location="dist"/> <target name="init"> <mkdir dir="${build}"/> </target> <target name="compile" depends="init"> <javac srcdir="${src}" destdir="${build}"/> </target> <target name="dist" depends="compile"> <mkdir dir="${dist}/lib"/> <jar jarfile="${dist}/lib/MyProject.jar" basedir="${build}"/> </target> <target name="clean"> <delete dir="${build}"/> <delete dir="${dist}"/> </target></project>

  23. Building DSLs

  24. Create ANTLR grammar • Generate lexer / parser • Parser will create parse tree • Transform parse tree to semantic model • Iterate model • Pass model element(s) to template

  25. Complicated

  26. Why not use a DSL... ... for building DSLs?

More Related