Skip to topic | Skip to bottom
Home
Transformers
Transformers.ESDFManualr1.1 - 22 Nov 2005 - 22:51 - NicolasPouillard?topic end

Start of topic | Skip to actions

Required software

The Stratego/XT program transformation tools are needed.
The distribution can be downloaded from http://www.stratego-language.org.

Please read the README file of Transformers to know which version to use.

For svn versions building, GNU help2man is needed.

Installing and building

People willing to try early working versions of the C++ transformation framework will need to checkout, build and install programs from the transformers subversion project:
svn checkout https://svn.lrde.epita.fr/svn/transformers/trunk

The bootstrap shell script is an automated bootstrap procedure that generates the configure scripts.

Example:

./bootstrap
export PKG_CONFIG_PATH=path_to_strategoxt_install_dir/lib/pkgconfig
./configure
make
make install

Using the tools

Thanks to the XTC transformation tool composition framework, using Transformers is painless, and easier than ever.

Parsing

First, we need to turn our C++ source code into an AST (Abstract Syntax Tree), which is more convenient to work with.
parse-cxx -i input.cc -o output.ast

AST displaying

At any time, it can be useful to graphically display an AST using the ag-viewer tool. ag-viewer requires the last unstable version of xulrunner.
parse-cxx -i input.cc -of asfix -o output.trm && ag-viewer output.trm

Applying transformations

Transformation tools are to be written in the Stratego language, using the signatures generated from our C++ grammar (Cxx.str). Then, applying the transformation is very easy.

Here is an example with the cxx-unfor transformation program.

cxx-unfor -i input.ast -o output.ast

Pretty-printing the resulting program

When all transformations have been executed, the abstract syntax tree can be pretty-printed back to a C++ source code, so that it can be compiled with a standard C++ compiler:
pp-cxx -i input.ast -o output.cc

Using the pipeline

All the StrategoXT tools can take a term on the standard input, and write the result on the standard output, which means that we can execute the whole transformation process without using temporary files.
parse-cxx -i input.cc | cxx-unfor | pp-cxx -o output.cc


to top


Copyright © 1999-2010 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback