Compiler
Notes
Programming languages
such as Pascal and C++ use compilers rather than interpreters. The figure shows the steps involved in using
a compiler.
First, the source
code is translated using the compiler to a file called an object file. An object file, however, is incomplete. A program called a linker is used to create
an executable program. The linker
combines the object file with other machine language necessary to create a
program that can run without an interpreter.
The linker produces an executable file which can be run as
many times as desired without the need for translating again.
Although using a
compiler involves more steps than using an interpreter, most C++ compilers
automate the task and make it easy for the programmer to use. For example, most compilers allow you to compile
and link in a single operation.
Programs you use
regularly, such as word processors and games, are examples of programs written
with a compiler. Compiled programs
require less memory than interpreted programs because a compiled program does
not require that an interpreter be loaded into memory. Compiled programs also run faster than
interpreted programs because the translation has already been done. When a compiled program is run, the program
is loaded into memory in the machine language the microprocessor needs.
