Introduction
The title of this page is deceptive: "G2" is not a preprocessor,
it's not even a tool. It is mainly an idea, a strategy.
This idea can be explained very simply: With only a small and
simple tool, you can turn any existing language into a text
preprocessor. The g2pp tool proposed on these pages,
implements this idea for one specific case: it lets TCL
act as a preprocessor language for C++. The documentation of the
tool often reminds you that the same idea can also easily
be implemented for other combinations of languages.
When developing C++ applications, I have often bumped into the
limitations of the C preprocessor. Sure, it has #define and #if,
but why doesn't it have loops, lists, arrays, procedures, objects,
file I/O and more? I would like my preprocessor to take over much
of the boring, repetitive and non-creative effort of C++ programming,
like managing member variables, writing a copy constructor and assignment
operator, making objects persistent on disk, etc. That's the itch I'm
trying to scratch.
Rather than inventing a new preprocessor language (which would imply
a steeper learning curve and a lot more development effort), I have chosen
to use TCL as the preprocessor language for C/C++. The flexibility and
extensibility of TCL are the main reasons for this choice; if you want,
you can easily adapt most of the ideas for use with other languages
(Python, Perl, Ruby, ...).
|
Download area
The following information is available for you to download:
- Documentation about the tool's
purposes and concepts, including lots of examples.
- g2pp-0.6.tgz:
Tarball with the sources, the documentation, and many examples that you
can immediately run and experiment with.
Includes TCL sources for clipboards, C++ generation, and roles.
Implemented and tested on Linux;
requires a sufficiently recent version of TCL (8.2 will do).
|