Node: Internals, Next: Copying, Previous: To Do, Up: Top

## The GPC Source Reference

> “The Source will be with you. Always.”

This chapter describes internals of GPC. It is meant for GPC developers and those who want to become developers, or just want to know more about how the compiler works. It does not contain information needed to just use GPC to compile programs.

This chapter tells you how to look up additional information about the GNU Pascal compiler from its source code.

Please note: If you intend to modify GPC's source, please check the top of each file you're going to modify. A number of files are generated automatically by various tools. The top of these files will tell you by which tool and from what file they were generated. Modifying a generated file is pointless, since it will be overwritten the next time the tool is run. Instead, modify the original source (which will usually be easier in fact, e.g. a bison input file vs. the generated C code). This also holds for various documentation and other files.

Proprietary compilers often come with a lot of technical information about the internals of the compiler. This is necessary because their vendors want to avoid to distribute the source of the compiler – which is always the most definitive source of this technical information.

With GNU compilers, on the other hand, you are free to get the source code, look how your compiler works internally, customize it for your own needs, and to re-distribute it in modified or unmodified form. You may even take money for this redistribution. (For details, see the GNU General Public License, Copying.)

The following subsections are your guide to the GNU Pascal source code. If you have further questions, be welcome to ask them at the GNU Pascal mailing list (see Support).

All file paths mentioned in this chapter are relative to the GNU Pascal source directory, a subdirectory `gcc/p` below the top-level GCC source directory.

The following sections roughly coincide with the order of the steps a Pascal source passes through during compilation (omitting the code generation which is the job of the GCC backend, and the assembler and linker steps at the end which are done by the programs `as` and `ld` of binutils and possibly other utilities like `collect2`). Also missing here is the compiler driver `gpc` which behaves very similarly to `gcc` and whose main job is to invoke the other parts in the right order, with the right arguments etc.

Note, this chapter docuemnts only selected parts of the compiler. Many things are missing because nobody has yet had the time to write something about them. In any case, for real understanding of the inner workings, you should always refer to the source code.

For more information, see the manual of GCC internals, Top.