The Spoofax Language Workbench provides tools for defining domain-specific languages (DSLs) with specialized syntax, semantics, and editor services. It offers declarative syntax definition with SDF, model transformations, static analysis for error checking, and semantic services for editors like content completion and error marking. Spoofax aims to make implementing these DSL features cheaply and integrates language development and use into the Eclipse IDE.
8. Syntax definition
Static semantics
Model-to-model transformation
Code generation
Syntactic Editor Services
Semantic Editor Services
}Spoofax
how can we make these things cheaply?
Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
9. • <spoofax screenshot: lang def and lang use
in Eclipse workspace>
Spoofax tutorial hands-on material: www.strategoxt.org/Spoofax/Devnology
17. #3 Equations
x = 2
y = 3
result = 90 * x + 30 * y
Assign(“x”, INT(2))
calc: Assign(x, e) -> e
where rules(GetValue: x -> e)
calc: Var(x) -> <GetValue> x
New syntax
New semantics
18. x = 2
y = 3
result = 90 * x + 30 * z
#4 Error markers
(Var(“z”), “Variable z is not defined”)
transform
19. #4 Error markers
analyze = topdown(try(record-var))
record-var:
Assign(x, e) -> Assign(x, e)
with
rules(
GetVar :+ x -> e
)
constraint-errors = collect-all(constraint-error, conc)
constraint-error:
Var(x) -> (x, $[Variable [x] is not defined])
where
not(<GetVar> x)
20. #4 Error markers
#5 Refinement
analyze = topdown(try(record-var))
record-var:
Assign(x, e) -> Assign(x, e)
with
rules(
GetVar :+ x -> e
)
constraint-errors = collect-all(constraint-error, conc)
constraint-error:
Var(x) -> (x, $[Variable [x] is not defined])
where
not(<GetVar> x)
21. #4 Error markers
#5 Refinement
editor-resolve:
(Var(x), position, ast, path, project-path) -> target
where
target := <GetVar> x
editor-complete:
(Var(x), position, ast, path, project-path) -> proposals
where
proposals := <all-keys-GetVar> x