gccint: Languages
1
1 5 Language Front Ends in GCC
1 ****************************
1
1 The interface to front ends for languages in GCC, and in particular the
1 'tree' structure (⇒GENERIC), was initially designed for C, and
1 many aspects of it are still somewhat biased towards C and C-like
1 languages. It is, however, reasonably well suited to other procedural
1 languages, and front ends for many such languages have been written for
1 GCC.
1
1 Writing a compiler as a front end for GCC, rather than compiling
1 directly to assembler or generating C code which is then compiled by
1 GCC, has several advantages:
1
1 * GCC front ends benefit from the support for many different target
1 machines already present in GCC.
1 * GCC front ends benefit from all the optimizations in GCC. Some of
1 these, such as alias analysis, may work better when GCC is
1 compiling directly from source code then when it is compiling from
1 generated C code.
1 * Better debugging information is generated when compiling directly
1 from source code than when going via intermediate generated C code.
1
1 Because of the advantages of writing a compiler as a GCC front end, GCC
1 front ends have also been created for languages very different from
1 those for which GCC was designed, such as the declarative
1 logic/functional language Mercury. For these reasons, it may also be
1 useful to implement compilers created for specialized purposes (for
1 example, as part of a research project) as GCC front ends.
1