Game Development Reference
In-Depth Information
Fig. 2.1
Translating a program using an assembler
Fig. 2.2
Translating a program using a compiler
for each processor, you need different programs for different computers, each of
them being translated by the corresponding assembler (see Fig. 2.1 ).
2.4.2 Compiler
The advantage of the majority of programming languages (except Assembler lan-
guages) is that, in principle, they can be written independently of the computer that
the program will be used on. So, only one program needs to be written, one that
can then be used on a variety of machines, by the use of an automatic translation
program. Such a program is called a compiler . So, the difference between an assem-
bler and a compiler is that whereas the assembler is specifically made to translate a
processor-dependent program to machine code, a compiler can translate a program
written in a processor- independent language to machine code. The compiler itself is
machine-specific, because it targets the machine code of the computer that the pro-
gram has to run on. The program written by the programmer (also called the source
code ) is machine-independent. Many procedural languages, such as C and C++, use
a compiler to translate the program into machine code. Figure 2.2 shows what the
translation process looks like when using a compiler.
Search WWH ::




Custom Search