Stratego/XT

Last updated
Stratego/XT
Stratego Logo.png
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

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

  1. "StrategoXT - Revision 25937: /strategoxt/trunk".
  2. Meta-programming with concrete object syntax
  3. Using the Java-front syntax definition
  4. 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 .

Related Research Articles

In computer science, a compiler-compiler or compiler generator is a programming tool that creates a parser, interpreter, or compiler from some form of formal description of a programming language and machine.

Abstract syntax tree

In computer science, an abstract syntax tree (AST), or just syntax tree, is a tree representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code.

Model-driven architecture (MDA) is a software design approach for the development of software systems. It provides a set of guidelines for the structuring of specifications, which are expressed as models. Model-driven architecture is a kind of domain engineering, and supports model-driven engineering of software systems. It was launched by the Object Management Group (OMG) in 2001.

The Object Constraint Language (OCL) is a declarative language describing rules applying to Unified Modeling Language (UML) models developed at IBM and is now part of the UML standard. Initially, OCL was merely a formal specification language extension for UML. OCL may now be used with any Meta-Object Facility (MOF) Object Management Group (OMG) meta-model, including UML. The Object Constraint Language is a precise text language that provides constraint and object query expressions on any MOF model or meta-model that cannot otherwise be expressed by diagrammatic notation. OCL is a key component of the new OMG standard recommendation for transforming models, the Queries/Views/Transformations (QVT) specification.

Apache Groovy Programming language

Apache Groovy is a Java-syntax-compatible object-oriented programming language for the Java platform. It is both a static and dynamic language with features similar to those of Python, Ruby, and Smalltalk. It can be used as both a programming language and a scripting language for the Java Platform, is compiled to Java virtual machine (JVM) bytecode, and interoperates seamlessly with other Java code and libraries. Groovy uses a curly-bracket syntax similar to Java's. Groovy supports closures, multiline strings, and expressions embedded in strings. Much of Groovy's power lies in its AST transformations, triggered through annotations.

A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains. There are a wide variety of DSLs, ranging from widely used languages for common domains, such as HTML for web pages, down to languages used by only one or a few pieces of software, such as MUSH soft code. DSLs can be further subdivided by the kind of language, and include domain-specific markup languages, domain-specific modeling languages, and domain-specific programming languages. Special-purpose computer languages have always existed in the computer age, but the term "domain-specific language" has become more popular due to the rise of domain-specific modeling. Simpler DSLs, particularly ones used by a single application, are sometimes informally called mini-languages.

A transformation language is a computer language designed to transform some input text in a certain formal language into a modified output text that meets some specific goal.

A program transformation is any operation that takes a computer program and generates another program. In many cases the transformed program is required to be semantically equivalent to the original, relative to a particular formal semantics and in fewer cases the transformations result in programs that semantically differ from the original in predictable ways.

In computer science, scannerless parsing performs tokenization and parsing in a single step, rather than breaking it up into a pipeline of a lexer followed by a parser, executing concurrently. A language grammar is scannerless if it uses a single formalism to express both the lexical and phrase level structure of the language.

QVT

QVT (Query/View/Transformation) is a standard set of languages for model transformation defined by the Object Management Group.

A model transformation language in systems and software engineering is a language intended specifically for model transformation.

The DMS Software Reengineering Toolkit is a proprietary set of program transformation tools available for automating custom source program analysis, modification, translation or generation of software systems for arbitrary mixtures of source languages for large scale software systems.

The Syntax Definition Formalism (SDF) is a metasyntax used to define context-free grammars: that is, a formal way to describe formal languages. It can express the entire range of context-free grammars. Its current version is SDF3. A parser and parser generator for SDF specifications are provided as part of the free ASF+SDF Meta Environment. These operate using the SGLR. An SDF parser outputs parse trees or, in the case of ambiguities, parse forests.

ASF+SDF Meta Environment

The ASF+SDF Meta-Environment is an IDE and toolset for interactive program analysis and transformation. It combines SDF, ASF and other technologies.

Strafunski is a functional programming-based toolset for implementing program analysis and transformation components. It is implemented in Haskell, and provides an API for operating on parse trees such as those generated by SDF.

Rascal is an experimental domain specific language for metaprogramming, such as static code analysis, program transformation, program generation and implementation of domain specific languages. It is a general meta language in the sense that it does not have a bias for any particular software language. It includes primitives from relational calculus and term rewriting. Its syntax and semantics are based on procedural (imperative) and functional programming.

Mirah is a programming language based on Ruby language syntax, local type inference, hybrid static–dynamic type system, and a pluggable compiler toolchain. Mirah was created by Charles Oliver Nutter to be "a 'Ruby-like' language, probably a subset of Ruby syntax, that [could] compile to solid, fast, idiomatic JVM bytecode." The word mirah refers to the gemstone ruby in the Javanese language, a play on the concept of Ruby in Java.

Eelco Visser is Antoni van Leeuwenhoek Professor of Computer Science at Delft University of Technology. He received an MSc and Doctorate in Computer Science from the University of Amsterdam in 1993 and 1997, respectively. Previously he served as a Postdoc at the Oregon Graduate Institute from 1997 to 1998, as assistant professor at Utrecht University from 1998 to 2006, and as associate professor at TU Delft from 2006 to 2013.

A language workbench is a tool or set of tools that enables software development in the language-oriented programming software development paradigm. A language workbench will typically include tools to support the definition, reuse and composition of domain-specific languages together with their integrated development environment. Language workbenches were introduced and popularized by Martin Fowler in 2005.