1 @c Copyright (C) 2002 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
6 @chapter Language Front Ends in GCC
8 The interface to front ends for languages in GCC, and in particular
9 the @code{tree} structure (@pxref{Trees}), was initially designed for
10 C, and many aspects of it are still somewhat biased towards C and
11 C-like languages. It is, however, reasonably well suited to other
12 procedural languages, and front ends for many such languages have been
15 Writing a compiler as a front end for GCC, rather than compiling
16 directly to assembler or generating C code which is then compiled by
17 GCC, has several advantages:
20 @item GCC front ends benefit from the support for many different
21 target machines already present in GCC@.
22 @item GCC front ends benefit from all the optimizations in GCC@. Some
23 of these, such as alias analysis, may work better when GCC is
24 compiling directly from source code then when it is compiling from
26 @item Better debugging information is generated when compiling
27 directly from source code than when going via intermediate generated C
31 Because of the advantages of writing a compiler as a GCC front end,
32 GCC front ends have also been created for languages very different
33 from those for which GCC was designed, such as the declarative
34 logic/functional language Mercury. For these reasons, it may also be
35 useful to implement compilers created for specialized purposes (for
36 example, as part of a research project) as GCC front ends.