Compiler
A compiler is a specialized computer program that converts source code written in one programming language into another language, usually machine language, so that it can be understood by processors.
Source code is the version of software (usually an application program or an operating system) as it is originally written by a human in plain text.
The first Compiler
The first compiler was developed in 1952 by Grace Hopper, a pioneering computer scientist. She said that she invented it because she was lazy and wished that “the programmer may return to being a mathematician.” This compiler is for the A-O programming language.
How First Compiler Worked
Admiral Hopper and her team extended the improvement on binary code with the development of her first compiler, the A-O. The A-O series of compilers translated symbolic mathematical code into machine code, and allowed the specification of call numbers assigned to the collected programming routines stored on magnetic tape. One could then simply specify the call numbers of the desired routines and the computer would “find them on the tape, bring them over and do the additions. This was the first compiler,”
Later Improvements
Admiral hopper moved forward with the development for Univac of the B-O compiler, later known as FLOW-MATIC. It was designed to translate a language that could be used for typical business tasks like automatic billing and payroll calculation. Using FLOW-MATIC, Admiral Hopper and her staff were able to make the UNIVAC I and II “understand” twenty statements in English.
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.
Compiler Structure and Operation
Compiling has several phases. They include extracting words from the source code, analyzing the sequence of such words and checking whether they match the syntax of the programming language for which the compiler is intended. While doing this, a compiler must adhere strictly to the meaning of the program being compiled.
At the same time, it must also be able to achieve the following goals, which are to some extent mutually exclusive, according to priorities set by the programmer: (1) maximize the speed of the compiled code, (2) minimize the size of the compiled code, (3) maximize the speed of the compilation process (i.e., compile-time efficiency), (4) maximize the debugging ability of the compiler (because most programs do not run optimally the first time they are compiled) and (5) maximize the useful feedback (i.e., reporting errors back to the programmer).
One key to simplifying the compiler development process has been the adoption of a three stage design. The first stage, called the front end, translates the source code into an intermediate representation. The second stage, referred to as the optimizer, optimizes the code according to the various switches on the compiler set by the programmer. The third stage, the back end, produces code in the output language. This structure allows either the front end to retarget the compiler’s source code language or the back end to retarget the output language, thereby making compilers more portable (e.g., for multiple dialects of a programming language).
After compilation, the object code must be linked with any required libraries of supporting routines by the linker before it is capable of being executed. The compiler usually invokes the linker automatically.
seen