Stratego — Term Transformations¶
The Stratego term transformation language caters for the definition of program transformations.
Transformations operate on the abstract syntax trees of programs. Abstract syntax trees are represented by means of first-order terms.
A program is structured as a collection of modules, which may import each other.
Transformations are defined by means of named rewrite rules. Rules may explicitly invoke rules. Alternatively, rules may be invoked by strategies that define how to combine rules into a more complex transformation using strategy combinators. Context-sensitive transformations can be expressed using dynamic rewrite rules.
Starting with Stratego 2, terms and transformation strategies are (gradually) typed.
In this reference manual we use placeholders to indicate the syntactic structure of language constructs. For example, a rewrite rule has the form
$Label : $Term -> $Term
in which the
$Label is the name of the rule, the first
$Term the left-hand side, and the second the right-hand side of the rule.
This convention should give an indication of the formal structure of a construct, without going down to the precise details of the syntax definition.
As a side effect, the schema also shows the preferred indentation of language constructs where that is applicable.
Not in Reference Manual¶
By using the concrete syntax of a language, transformations can be expressed in the native syntax of the language under transformation, rather than using abstract syntax.
The Stratego standard library is a collection of modules that are available with each Stratego program and on which the runtime library relies.
Find automatically generated documentation at the following sites:
The sources of the different Stratego components can be found at:
- stratego.lang: Stratego language specification
- strategolib: Stratego core library
- strategoxt: Stratego/XT ecosystem
Created: May 17, 2023