instructions, or source code, directly into actions. A compiler translates source code into
an intermediary form. This step is called compiling, and it produces an object file. A
linking application called a linker runs after the compiler and combines the object file
into an executable program containing machine code that can directly be run on the
Because interpreters read the source code as it is written and execute the code on the
spot, interpreters can be easier for the programmer to work with. Today, most interpreted
programs are referred to as scripts, and the interpreter itself is often called a script
Compilers introduce the extra steps of compiling the source code (which is readable by
humans) into object code (which is readable by machines). This extra step might seem
inconvenient, but compiled programs run very fast because the time-consuming task of
translating the source code into machine language has already been done once, at compile
time. Because the translation is already done, it is not required when you execute the
Another advantage of compiled languages such as C++ is that you can distribute the executable
program to people who don’t have the compiler. With an interpreted language,
you must have the interpreter installed to run the program on any computer.
Some high-level languages, such as Visual Basic 6, call the interpreter the runtime
library. Other languages, such as C#, Visual Basic .NET, and Java have another component,
referred to as a virtual machine (VM) or a runtime. The VM is also an interpreter.
However, it is not a source code interpreter that translates human-readable language into
computer-dependent machine code. Rather, it interprets and executes a compiled
computer-independent virtual machine language or intermediary language. These
languages, therefore, still feature a compiler or a compilation step during which the
source code written by a programmer is first translated; that is, compiled into content
that can be interpreted by the virtual machine or runtime library.
C++ is typically a compiled language, although there are some C++ interpreters. Like
many compiled languages, C++ has a reputation for producing fast and powerful programs.
Interpreters and Compilers