A compiler is a specialized computer program that converts source code written in one programming language into another language, usually machine language (also called machine code) so that it can be understood by processors (i.e., logic chips).
Source code is the version of software (usually an application programme or an operating system) as it is originally written (i.e., typed into a computer) by a human in plain text (i.e., human readable alphanumeric characters). Source code can be written in any of numerous programming languages, some of the most popular of which are C, C++, Java, Perl, PHP, Python and Tcl/Tk. The output of a compiler is referred to as object code.
Towards the end of the 1950s, machine-independent programming languages were first proposed. Subsequently, several experimental compilers were developed. The first compiler was written by Grace Hopper, in 1952, for the A-0 programming language. She said that she invented it because she was lazy and wished that “the programmer may return to being a mathematician.” She is also well known for her important role in the development of the COBOL programming language (which is still in widespread use for business applications), including the development of the first COBOL compiler. The FORTRAN team led by John Backus at IBM is generally credited as having introduced the first complete compiler, in 1957. COBOL was an early language to be compiled on multiple architectures, in 1960.In many application domains the idea of using a higher level language quickly caught on. Because of the expanding functionality supported by newer programming languages and the increasing complexity of computer architectures, compilers have become more and more complex.
Early compilers were written in assembly language. The first self-hosting compiler — capable of compiling its own source code in a high-level language — was created for Lisp by Hart and Levin at MIT in 1962. Since the 1970s it has become common practice to implement a compiler in the language it compiles, although both Pascal and C have been popular choices for implementation language. Building a self-hosting compiler is a bootstrapping problem — the first such compiler for a language must be compiled either by a compiler written in a different language, or (as in Hart and Levin’s Lisp compiler) compiled by running the compiler in an interpreter.
The number of compilers grew swiftly accompanying the proliferation of programming languages and processors and the advances in compiler technology. The 1990s saw a surge in the introduction of free compilers and compiler development tools, including those developed as part of the GNU project, whose purpose is to create a high performance and completely free operating system.
The highly regarded GCC (GNU Compiler Collection) is considered by many to be the most important piece of free software (i.e., software that is free not only in a monetary sense but also with regard to all aspects of use). Formerly called the GNU C Compiler, it now contains compilers for the C, C++, Objective C, Fortran, Java and Ada programming languages. It has been ported to (i.e., modified to run on) more processors and operating systems than any other compiler, and it runs on in excess of 60 platforms (i.e., combinations of processors and operating systems).
Software for early computers was exclusively written in assembly language for many years. Higher level programming languages were not invented until the benefits of being able to reuse software on different kinds of CPUs started to become significantly greater than the cost of writing a compiler. The very limited memory capacity of early computers also created many technical problems when implementing a compiler.