Transformers
Overview
Thanks to the keyword
template, and almost by accident, C++ is a very special language where one can not only specify what a program will do once compiled, but in addition one can specify how
the compiler will compile a program. This feature gave birth to powerful programming techniques, commonly referred to as ``metaprogramming''. Because of its committment in the
Olena and
Vaucanson projects, the LRDE has developped expertize in metaprogramming. Unfortunately the implementation is tricky and very error-prone.
Starting from the simple idea that ``we want metaprogramming efficiency, but we don't want to write it'', the
Transformers project was initiated. It aims at converting naive (but decent) C++ programming into high-speed (but indecent) C++ source code. To this end, several tasks must be addressed: basically the
Transformers project aims at designing a set of tools to manipulate C++ programs.
The
software we use to build those tools comes mainly from
XT.
Its main goal is to ease the use of static C++ programming patterns, such as the ones which are currently in use in
Olena or
Vaucanson by letting the programmer use classical (human readable) C++ code and transform it into efficient generic code.
There are several steps to go before we have a usable tool.
Current work
The
Transformers project focuses on standard compliance and uses an extensible front-end which is divided in two main processes:
Parsing
Using the C99 (ISO/IEC 9899) or C++03 (ISO/IEC 14882-2003) standard,
Transformers aims to parse any C or C++ source file. It is designed to allow grammar extensions (see
Class Namespaces extension) and easy transformations. Since these grammars are ambiguous, a generalized parser (
SGLR) is used to produce a parse forest from the input source file, which must be disambiguated afterwards.
Disambiguation
In order to disambiguate the parse forest,
Transformers uses the attribute grammar formalism. Since the disambiguation should not be separated from the grammar, a tool was written to add attributes in the SDF grammar, using Statego code. An evaluator will then propagate contextual information and eventually identify invalid trees in the parse forest.
For more information, see
CTransformers or
CxxTransformers.
What's next?
- Type checker.
- Transformations.
- AST manipulation framework.
Documentation
Mailing list
You can subscribe to the
Transformers mailing lists on the following pages:
Download
See also
to top