the spoofax language workbench
play

The Spoofax Language Workbench Lennart Kats Eelco Visser Software - PowerPoint PPT Presentation

The Spoofax Language Workbench Lennart Kats Eelco Visser Software Engineering implement Problem Software validate High-level languages reduce problem/solution gap Problem HLL Machine Domain Domain-Specific Languages Problem DSL HLL


  1. The Spoofax Language Workbench Lennart Kats Eelco Visser

  2. Software Engineering implement Problem Software validate

  3. High-level languages reduce problem/solution gap Problem HLL Machine Domain

  4. Domain-Specific Languages Problem DSL HLL Machine Domain DSLs further reduce gap between problem domain and implementation

  5. Example DSL:

  6. paradigm: linguistic abstraction

  7. making languages should be cheap

  8. Compiler Ingredients Syntax definition concrete syntax ★ parser abstract syntax ★ generators Static semantics meta- programming error checking ★ libraries name resolution ★ meta- type analysis ★ programming Model-to-model transformation languages template express constructs in core language ★ engines Code generation translate core language models to implementation ★

  9. Editor Services syntactic editor services semantic editor services • • syntax highlighting error marking • • syntax checking reference resolving • • outline view hover help • • bracket matching, insertion mark occurrences • • automatic indentation content completion • • syntax completion refactoring • • ... ...

  10. Semantic Editor Services } Syntax definition Static semantics Model-to-model transformation Language workbenches Code generation [Fowler ’05] Syntactic Editor Services how can we make these things cheaply?

  11. Language Workbench: integrated environment for language definition

  12. Holy Grail of Software Language Definition Automatically derive efficient, scalable, incremental compiler + usable IDE from high-level, declarative language definition

  13. Stratego SDF Eclipse IMP

  14. Stratego Language Definition by Transformation SDF Eclipse IMP

  15. • <spoofax screenshot: lang def and lang use in Eclipse workspace>

  16. SDF: Declarative Syntax Definition

  17. A syntax definition specifies a transformation from text to trees

  18. Syntax as Transformation

  19. Syntax as Transformation

  20. Syntax as Transformation t r a n s f o r m

  21. Syntax as Transformation t r a n s f o r m

  22. Syntax as Transformation t r a n s f o r m

  23. Semantics = transformation

  24. Error Marking is a Transformation t r a n s f o r m

  25. Error Marking is a Transformation t r a n s f o r m

  26. Error Marking is a Transformation t r a n s f o r m transform

  27. Error Marking is a Transformation t r a n s f o r m transform

  28. Error Marking is a Transformation t r a n s f o r m transform

  29. Outline View is a Transformation transform

  30. Hyperlinking is a Transformation transform

  31. Content Completion is a Transformation transform transform

  32. Code Generation is a Transformation t r a n s f o r m

  33. Need for single, unified language specification: • Editor services • Model transformations • Code generation

  34. Stratego: Rewriting Language

  35. Rewrite rules Strategies

  36. Error Marking with Rewrite Rules

  37. Error Marking with Rewrite Rules

  38. Error Marking with Rewrite Rules t Origin tracking r a n s f o r m transform

  39. Analysis with Rewrite Rules

  40. Code Generation with Rewrite Rules

  41. Conclusion • Co-evolution of language and IDE • Pure and declarative syntax definition • Language definition by transformation • www.spoofax.org: papers, tour, download

Recommend


More recommend