This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Figure 12.7.
As shown in the figure, the input to the compiler is the high-level language
program (often referred to as a source program) and its output is the machine
language program (often referred to as an object program). Since high-level
language instructions are macro instructions, the compiler translates each highlevel language instruction into a set of machine language instructions rather than a
single machine language instruction. Hence there is one-to-many correspondence
between the high-level language instructions of a source program and the machine
instructions of its equivalent object program. Note that during the process of
translation of a source program into its equivalent object program by the compiler,
the source program is not being executed. It is only being converted into a form
that can be executed by the computer's processor.
High-level language program -►input -►complier-►output-►Machine language
(Source Program) -► One-to-many correspondence-► (Object Program)
A compiler can translate only those source programs, which have been written in
the language for which the compiler is meant. For example, a FORTRAN
compiler is only capable of translating source programs, which have been written in FORTRAN. Therefore, each computer requires a separate compiler for each
high-level language that it supports. That is, to execute both FORTRAN and
COBOL programs on a computer, this computer must have a FORTRAN compiler
and a COBOL compiler. This is illustrated in Figure 12.8.
Program PI in high-level language LI -►Compiler for language LI -► Machine
code for PI
Program P2 in high-level language L2 -►Compiler for language L2-► Machine
code for P2
A computer supporting languages LI and L2
Figure 12.8. Illustrating the requirement of a separate compiler for each high-level
language supported by a computer.
Also note that an object program for one computer will not be the same as the
object program for another computer. Hence it is...
View Full Document
- Spring '14