Cfront
Encyclopedia
Cfront was the original compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

 for C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

 (then known as "C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 with Classes") from around 1983, which converted C++ to C; developed by Bjarne Stroustrup
Bjarne Stroustrup
Bjarne Stroustrup ; born December 30, 1950 in Århus, Denmark) is a Danish computer scientist, most notable for the creation and the development of the widely used C++ programming language...

. The preprocessor
Preprocessor
In computer science, a preprocessor is a program that processes its input data to produce output that is used as input to another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers...

 did not understand all of the language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 and much of the code
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...

 was written via translations. Cfront had a complete parser, built symbol table
Symbol table
In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier in a program's source code is associated with information relating to its declaration or appearance in the source, such as its type, scope level and...

s, and built a tree for each class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

, function, etc. Cfront was based on CPre (C with classes compiler, which started at 1979).

As Cfront was written in C++, it was a challenge to bootstrap
Bootstrapping (compilers)
In computer science, bootstrapping is the process of writing a compiler in the target programming language which it is intended to compile...

 on a machine without a C++ compiler/translator. Along with the Cfront C++ sources, a special "half-preprocessed" version of the C code resulting from compiling Cfront with itself was also provided. This C code was to be compiled with the native C compiler, and the resulting executable could then be used to compile the Cfront C++ sources.

Most of the porting effort in getting Cfront running on a new machine was related to standard I/O. Cfront's C++ streams were closely tied in with the C library's buffered I/O streams, but there was little interaction with the rest of the C environment. The compiler could be ported to most System V derivatives without many changes, but BSD-based systems usually had many more variations in their C libraries and associated stdio structures.

Cfront defined the language until circa 1990, and many of the more obscure corner cases in C++ were related to its C++-to-C translation approach. A few remnants of Cfront's translation method are still found in today's C++ compilers; name mangling
Name mangling
In compiler construction, name mangling is a technique used to solve various problems caused by the need to resolve unique names for programming entities in many modern programming languages....

 was originated by Cfront, as the relatively primitive linkers at the time did not support type information in symbols, and some template instantiation models are derived from Cfront's early efforts. C++ (and Cfront) was directly responsible for many improvements in Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 linkers and object file
Object file
An object file is a file containing relocatable format machine code that is usually not directly executable. Object files are produced by an assembler, compiler, or other language translator, and used as input to the linker....

 format
File format
A file format is a particular way that information is encoded for storage in a computer file.Since a disk drive, or indeed any computer storage, can store only bits, the computer must have some way of converting information to 0s and 1s and vice-versa. There are different kinds of formats for...

s, as it was the first widely-used language which required link-time type checking, weak symbol
Weak symbol
In computing, a weak symbol is a symbol definition in an object file or dynamic library that may be overridden by other symbol definitions. Its value will be zero if no definition is found by the loader....

s, and other similar features.

Cfront 4.0 was abandoned in 1993 after a failed attempt to add exception
Exception handling
Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions, special conditions that change the normal flow of program execution....

 support. The C++ language had grown beyond its capabilities; however a compiler with similar approach became available later, namely Comeau C/C++
Comeau C/C++
Comeau C/C++ is a C and C++ compiler produced by Comeau Computing.The compiler supports several dialects of both the C and C++ languages...

.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK