The C++ Front End
The C++ front end supports the ISO/IEC 14882 standard. The C++14, C++11, and C++98/03 versions of the language are fully supported. Most of C++17 is supported, and all of C++17 will be supported shortly (see our description of language features).
Under control of command-line options, the front end also supports ANSI/ISO C (both C89 and C99, and the Embedded C TR), the Microsoft dialects of C and C++ (including C++/CLI), GNU C and C++, Clang C and C++, Sun C++, the cfront 2.1 and 3.0.n dialects of C++, and K&R/pcc C.
The front end does complete syntax and semantic analysis, including complete error checking. It produces about 2,500 different error messages. Diagnostics always display the source line with a caret indicating the exact position of the error. The level of diagnostic output can be controlled in various ways.
The front end can handle international character sets, including multibyte character sets and various encodings of Unicode, in strings, identifiers, comments, and file names. The diagnostics emitted by the front end are contained in an error message catalog which can easily be translated to other languages.
The front end translates source programs into a high-level, tree-structured, in-memory intermediate language. The intermediate language preserves a great deal of source information (e.g., line numbers, column numbers, original types, original names), which is helpful in generating symbolic debugging information as well as in source analysis and transformation applications. Implicit and overloaded operations in the source program are made explicit in the intermediate language, but constructs are not otherwise added, removed, or reordered. The intermediate language is not machine dependent (e.g., it does not specify registers or dictate the layout of stack frames). The front end can optionally generate raw cross-reference information, which can be used as a basis for building source browsing tools.
The front end includes an integrated preprocessor, which can do modern or pcc-style preprocessing. Normally, the preprocessor runs as part of the front end, and no intermediate textual file is created. However, a preprocessed output file can be produced if desired. Precompiled header files can be created and used.
Also included: a C-generating back end, which can be used to generate C code for C++ programs; a C++-generating back end, which is useful for source-to-source transformation applications; a prelinker, which handles automatic template instantiation; a minimal runtime library (but not any "real" libraries, e.g., for stream I/O); utilities to write the intermediate language to a file, read it back in, and display it in human-readable form; and a name demangler.
The front end consists of about 655,000 lines of source code, of which about 30% are comments. The code is written in ISO C, with host and target dependencies carefully segregated from the bulk of the code. It can be rehosted easily on a variety of machines and operating systems. Since the host and target dependencies are separately configurable, the front end can be used as part of a cross compiler. There is extensive debugging and consistency-checking code, which can be included or excluded by conditional compilation.
The internal documentation comprises about 600 pages. The "External Interface" chapter of that document, covering command-line options, language dialect issues, and the use of language features like templates, is freely available for downloading in PDF format.