Stratego/XT
Stable release |
0.17
/ July 8, 2009 |
---|---|
Operating system | Linux, Unix, Mac OS X, Windows |
Type | program transformation system |
License | LGPLv2+[1] |
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 on 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.
Concrete syntax
Program transformations often operate by modifying the abstract syntax tree (AST). In Stratego it is also possible to specify transformations using concrete syntax.[2] 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.
Examples
A rule to desugar a do-while statement in Java:[3]
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); ]|
See also
- ASF+SDF Meta Environment
- DMS Software Reengineering Toolkit
- Program transformation
- Source code generation
History
The theoretical framework for Stratego, called System S, was first described in a paper [4] by Eelco Visser and Zine-el-Abidine Benaissa.
Notes
- ↑ "StrategoXT - Revision 25937: /strategoxt/trunk".
- ↑ Meta-programming with concrete object syntax
- ↑ Using the Java-front syntax definition
- ↑ Visser, Eelco; Zine-el-Abidine Benaissa (1998). "A Core Language for Rewriting". Second International Workshop on Rewriting Logic and its Applications (WRLA 1998). 15. Elsevier Science Publishers. pp. 422–441. doi:10.1016/S1571-0661(05)80027-1.