190075Sobrien@c Copyright (C) 2002 Free Software Foundation, Inc. 290075Sobrien@c This is part of the GCC manual. 390075Sobrien@c For copying conditions, see the file gcc.texi. 490075Sobrien 590075Sobrien@node Languages 690075Sobrien@chapter Language Front Ends in GCC 790075Sobrien 890075SobrienThe interface to front ends for languages in GCC, and in particular 990075Sobrienthe @code{tree} structure (@pxref{Trees}), was initially designed for 1090075SobrienC, and many aspects of it are still somewhat biased towards C and 1190075SobrienC-like languages. It is, however, reasonably well suited to other 1290075Sobrienprocedural languages, and front ends for many such languages have been 1390075Sobrienwritten for GCC@. 1490075Sobrien 1590075SobrienWriting a compiler as a front end for GCC, rather than compiling 1690075Sobriendirectly to assembler or generating C code which is then compiled by 1790075SobrienGCC, has several advantages: 1890075Sobrien 1990075Sobrien@itemize @bullet 2090075Sobrien@item GCC front ends benefit from the support for many different 2190075Sobrientarget machines already present in GCC@. 2290075Sobrien@item GCC front ends benefit from all the optimizations in GCC@. Some 2390075Sobrienof these, such as alias analysis, may work better when GCC is 2490075Sobriencompiling directly from source code then when it is compiling from 2590075Sobriengenerated C code. 2690075Sobrien@item Better debugging information is generated when compiling 2790075Sobriendirectly from source code than when going via intermediate generated C 2890075Sobriencode. 2990075Sobrien@end itemize 3090075Sobrien 3190075SobrienBecause of the advantages of writing a compiler as a GCC front end, 3290075SobrienGCC front ends have also been created for languages very different 3390075Sobrienfrom those for which GCC was designed, such as the declarative 3490075Sobrienlogic/functional language Mercury. For these reasons, it may also be 3590075Sobrienuseful to implement compilers created for specialized purposes (for 3690075Sobrienexample, as part of a research project) as GCC front ends. 37