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