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

the spoofax language workbench
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

The Spoofax Language Workbench

Eelco Visser Lennart Kats

slide-2
SLIDE 2

Problem Software

implement validate

Software Engineering

slide-3
SLIDE 3

Problem Domain HLL Machine

High-level languages reduce problem/solution gap

slide-4
SLIDE 4

Problem Domain HLL Machine DSL

DSLs further reduce gap between problem domain and implementation

Domain-Specific Languages

slide-5
SLIDE 5

Example DSL:

slide-6
SLIDE 6

paradigm: linguistic abstraction

slide-7
SLIDE 7

making languages should be cheap

slide-8
SLIDE 8

Compiler Ingredients

Syntax definition

concrete syntax

abstract syntax

Static semantics

error checking

name resolution

type analysis

Model-to-model transformation

express constructs in core language

Code generation

translate core language models to implementation

parser generators meta- programming languages meta- programming libraries template engines

slide-9
SLIDE 9
slide-10
SLIDE 10
slide-11
SLIDE 11
slide-12
SLIDE 12
slide-13
SLIDE 13
slide-14
SLIDE 14

Editor Services

syntactic editor services

  • syntax highlighting
  • syntax checking
  • utline view
  • bracket matching, insertion
  • automatic indentation
  • syntax completion
  • ...

semantic editor services

  • error marking
  • reference resolving
  • hover help
  • mark occurrences
  • content completion
  • refactoring
  • ...
slide-15
SLIDE 15

Syntax definition Static semantics Model-to-model transformation Code generation Syntactic Editor Services Semantic Editor Services }

Language workbenches [Fowler ’05] how can we make these things cheaply?

slide-16
SLIDE 16

Language Workbench: integrated environment for language definition

slide-17
SLIDE 17

Holy Grail of Software Language Definition

Automatically derive efficient,

scalable, incremental compiler + usable IDE from high-level,

declarative language definition

slide-18
SLIDE 18

SDF Stratego Eclipse IMP

slide-19
SLIDE 19

SDF Stratego Eclipse IMP

Language Definition by Transformation

slide-20
SLIDE 20
  • <spoofax screenshot: lang def and lang use

in Eclipse workspace>

slide-21
SLIDE 21

SDF: Declarative Syntax Definition

slide-22
SLIDE 22
slide-23
SLIDE 23

A syntax definition

specifies a transformation from text to trees

slide-24
SLIDE 24

Syntax as Transformation

slide-25
SLIDE 25

Syntax as Transformation

slide-26
SLIDE 26

Syntax as Transformation

t r a n s f

  • r

m

slide-27
SLIDE 27

Syntax as Transformation

t r a n s f

  • r

m

slide-28
SLIDE 28

Syntax as Transformation

t r a n s f

  • r

m

slide-29
SLIDE 29

Semantics

=

transformation

slide-30
SLIDE 30

Error Marking is a Transformation

t r a n s f

  • r

m

slide-31
SLIDE 31

t r a n s f

  • r

m

Error Marking is a Transformation

slide-32
SLIDE 32

transform

Error Marking is a Transformation

t r a n s f

  • r

m

slide-33
SLIDE 33

transform

Error Marking is a Transformation

t r a n s f

  • r

m

slide-34
SLIDE 34

transform

Error Marking is a Transformation

t r a n s f

  • r

m

slide-35
SLIDE 35

Outline View is a Transformation

transform

slide-36
SLIDE 36

Hyperlinking is a Transformation

transform

slide-37
SLIDE 37

Content Completion is a Transformation

transform transform

slide-38
SLIDE 38

Code Generation is a Transformation

t r a n s f

  • r

m

slide-39
SLIDE 39

Need for single, unified language specification:

  • Editor services
  • Model transformations
  • Code generation
slide-40
SLIDE 40

Stratego: Rewriting Language

slide-41
SLIDE 41

Rewrite rules Strategies

slide-42
SLIDE 42

Error Marking with Rewrite Rules

slide-43
SLIDE 43

Error Marking with Rewrite Rules

slide-44
SLIDE 44

transform t r a n s f

  • r

m

Error Marking with Rewrite Rules

Origin tracking

slide-45
SLIDE 45

Analysis with Rewrite Rules

slide-46
SLIDE 46

Code Generation with Rewrite Rules

slide-47
SLIDE 47

Conclusion

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