The Developing System
The developing system is based on a precompiler. It works in conjunction
with GNU G++ compiler.
From the point of view of the user, it operates after the preprocessing
phase and before the actual compilation.
We introduce some new extension for filenames. Here is a complete list:
- ECO C++ compilation unit
- ECO C++ header file
- The result of a preprocessing of an ECO C++
compilation unit (.eco)
- The result of a precompiling of an ECO C++ ".temp" file
- The result of a compilation of a ".ii" file
The following are the steps for compiling an ECO C++ compilation unit
- This preprocesses the compilation unit using the C++ preprocessor
g++ -E filename.eco >filename.temp
- This precompiles filename.temp using the precompiler named eco_prec
eco_prec filename.temp >filename.ii
- This compiles filename.ii and generate a .o object module
- The generated object module must be linked with other modules deriving
from ECO C++ or C++ compilation units.
The following figure show the pipeline.
The sequence of commands is complicated but the using of MAKE simplifies
Inside the precompiler
The precompiler is written using GNU G++.
The most part of the input is copied to the output without modification.
Only the parts related to ECO C++ primitives are modified.
To generate C++ from ECO C++ precompiler must know much information
about definitions in the source code, so a large part of the code of the
precompiler perform the manipulation the symbol database.
Much care has been posed in the analysis of the C++ entities (see ANSI
working paper on C++) to obtain a well engineered database. A hierarchy
of classes models all entities.
The following figure shows the internal structure of the precompiler:
The Substituter is a module that copies the input to the output
but can be driven to modify some part during the copy.
The front-end was built using FLEX, a lexical analyzer generator, and
BISON, a parser generator. Both are widely used and they are freely available
on the Internet. The grammar file is derived from the G++ 2.7.2 grammar,
with minor changes in the grammar part and major changes in the semantic
part. The lexical analyzer had been rewritten, but it behaves essentially
as the original G++ lexical analyzer (that is, it is context dependent).
In the following figure, it is described the hierarchy out of which
the database is built:
Do you wont to magnify?
17Kb (in italian)