(1) Software that converts a set of high-level language statements into a lower-level representation. For example, a help compiler converts a text document embedded with appropriate commands into an online help system. A dictionary compiler converts terms and definitions into a dictionary lookup system.
(2) Software that translates a program written in a high-level programming language (C/C++, COBOL, etc.) into machine language. A compiler usually generates assembly language first and then translates the assembly language into machine language. A utility known as a "linker" then combines all required machine language modules into an executable program that can run in the computer. See optimizing compiler.
The following is a conceptual example of source code being converted to machine language by the compiler:
Source Code Assembly Language Machine Language
IF COUNT=10 Compare A to B Compare 3477 2883
GOTO DONE If equal go to C If = go to 23883
ELSE Go to D Go to 23343
GOTO AGAIN
ENDIF
Actual Machine Code (simulated)
10010101001010001010100
10101010010101001001010
10100101010001010010010

A C/C++ compiler converts C and C++ code into assembly language as shown in this example. The red arrows point to various function calls, and the assembly code to perform those calls follows each statement.

Compiled programs (right) are translated into the machine language of the target computer. Interpreted programs (left and center) are either kept in their original source code or are precompiled into an intermediate form. In both cases, an interpreter is required to translate the program into machine language at runtime, whereas the compiled program is "ready to go."
|