The first decision involved choosing the language in which GNAT should be written. GCC is fully written in C, but for technical reasons as well as non-technical ones, it was inconceivable to use anything but Ada for GNAT itself. The GNAT team started using a relatively small subset of Ada83, and in typical fashion, extended the subset whenever new features became implemented. Six months after the coding started in earnest, we were able to bootstrap the compiler, and abandon the commercial compiler we had been using up to that point. As Ada95 features are implemented, we are now able to write GNAT in Ada95. In fact, the definition of the language depends heavily on hierarchical libraries, and cannot be given except in Ada95, so that it is natural for the compiler and the environment to use child units throughout [SGC94, Section 3.1].
Figure presents the overall structure of the GNAT system. It has three main parts: the Compiler, the Run Time System and the Binder (the GNU linker for the target operating system is always reused). From the figure, we can also deduce the steps followed to compile an Ada program.
The GNAT binder verifies the consistency of the objects and determines a valid order of elaboration (initialization) for the objects (from the same or different languages) that are to be assembled into an executable file. Following this sketch, the next sections of this chapter describe each part of the compiler.