Stable release | 0.17 / July 8, 2009 |
---|---|
Operating system | Linux, Unix, Mac OS X, Windows |
Type | program transformation system |
License | LGPL |
Website | http://www.strategoxt.org |
Stratego/XT is a language and toolset for constructing stand-alone program transformation systems. It combines the Stratego transformation language with the XT toolset of transformation components, providing a framework for constructing stand-alone program transformation systems. The Stratego language is based around a programming paradigm called strategic term rewriting. It provides rewrite rules for expressing basic transformation steps. The application of these rules can be controlled using strategies, a form of subroutines. The XT toolset provides reusable transformation components and declarative languages for deriving new components, such as parsing grammars using the Modular Syntax Definition Formalism (SDF) and implementing pretty-printing.
Contents |
Program transformations often operate by modifying the abstract syntax tree (AST). In Stratego it is also possible to specify transformations using concrete syntax.[1] This allows programmers to express a transformation using the familiar (and often more concise) syntax of the object programming language, while it internally still operates on the AST.
A rule to desugar a do-while statement in Java:[2]
desugar : While(e, stm) -> If(e, DoWhile(stm, e))
The same rule, using concrete syntax:
desugar : |[ while (e) stm; ]| -> |[ if (e) do stm while(e); ]|
The theoretical framework for Stratego, called System S, was first described in a paper [3] by Eelco Visser and Zine-el-Abidine Benaissa.