rose  0.9.5a-without-EDG-20584
About: ROSE is a compiler infrastructure to build source-to-source program transformation and analysis tools for large-scale Fortran 77/95/2003, C, C++, OpenMP, and UPC applications. Hint: This is ROSE-edg3 (being phased out, no longer maintained since March, 2013), so you may look for ROSE-edg4 (the actively maintained one).
  Fossies Dox: rose-0.9.5a-without-EDG-20584.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rose Documentation



Minitermite is a light-weight library that transforms C, C++, and Fortran programs into a term-based representation of their abstract syntax trees (AST) and vice versa. Minitermite is based on the ROSE compiler. From a end-user's point of view minitermite provides two tools src2term and term2src that perform the transformation between source code and term formats.

The term representation generated by minitermite is useful in many applications, for example, source-to-source transformation. The following diagram depicts how minitermite can be used to hook up a Stratego term rewrite engine to the ROSE infrastructure:

 original    src2term            Stratego            term2src   transf'd
+--------+   +-----+                                  +----+   +--------+
|src1.c  |   |     |                                  |    |   |src1.c  |
|src2.f90|-->|ROSE |->proj.term-->TRANS-->proj1.term->|ROSE|-->|src2.f90|
|src3.cpp|   +-----+  ^            FORM!              |    |   |src3.cpp|
+--------+ -> clang --|                               +----+   +--------+

In the past, we also successfully used (mini-)termite together with the CiME3 term rewrite system and with the Prolog programming language which we used to create static program analyses and compilers.

For more information, please consult the man pages src2term(1) and term2src(1) or run the tools with the –help option.


For the term generation, we support 3.5 backends:

  • STL This is the default fall-back implementation based on C++ strings.

  • SWI-Prolog If minitermite is configured with the –with-swi-prolog switch, all terms are generated as native Prolog objects. This representation is significantly more memory efficient, since Atoms are shared. Also, Prolog queries can be executed on the term representation in memory without having to go out to the disk.

  • Stratego This backend is based off the STL backend and provides an alternate syntax that is compatible with what the Stratego [1] term rewrite system accepts. It can be activated by passing the –stratego switch to src2term and friends.

  • Clang (C -> term only) There is also a patch for an older version of the Clang compiler that adds an –emit-term option. This is meant as an alternative to the ROSE frontend. The patched version of Clang can be built with the make clang target. It will fetch the required version of Clang from SVN and apply the patch automatically.


Term grammar definition and additional tools

Note: the following tools are written in Prolog and will only be installed if minitermite is configured with the –with-swi-prolog switch.

To aid with the debugging of rewrite, we are providing the tool termite_lint, which checks term files against a formal grammar of legal terms. The grammar can be found in src/termite/

A pretty printer for terms is called termpretty. The utilities cime3-signatures and stratego-signatures output the term grammar in a format understood by the CiME3 and Stratego term rewrite systems, respectively.

Related work, Provenance

Minitermite is a spin-off (friendly fork) of Termite [2] which is distributed as part of the SATIrE program analysis framework [3] from the Computer Languages group at Vienna University of Technology, Austria.

[2] [3]


The corresponding author and maintainer is Adrian Prantl. The original Termite was based on an earlier prototype by Christoph Bonitz and Markus Schordan. Gergo Barany contributed the term_lint grammar checker, as well as support for the ICFG and other PAG-based analyses and numerous bug fixes and improvements. Several testcases were contributed by Viktor Pavlu. The majority of the Clang front-end integration was contributed by Dietmar Ebner with some help from Florian Brandner.

Installation instructions

The following commands should do the job on a UNIX-like system::

mkdir build && cd build
../configure --prefix=/usr/local --with-rosedir=/opt/rose 
             --with-boostdir=/usr --with-swi-prolog=no
make -j<N> install
make installcheck


ROSE: flex, yacc, boost

Optional: swi-prolog, clang, doxygen, rst2man


Just like SATIrE, minitermite is distributed under a permissive three-clause BSD license. See COPYING for details.