Previous | Next | Table of Contents | Index | Program List | Copyright
1.6 Processing a High-Level Language Program
Before it can be processed, a high-level language program must be entered at
the terminal, then translated, and finally loaded into memory for execution. A
number of software tools--programs that help us develop other
programs--assist in this task. These are described next, and the process is
summarized in Figure 1.6.
Figure 1.6
Preparing a Program for Execution
- Use an editor program to enter the source program into memory and
save it on disk as a source file.
- Use a compiler program to translate the source program into machine
language. Often, one or more statements in the source file will contain a
syntax error or semantic error. This means that these statements
do not correspond exactly to the rules of the high-level language. In this
case, the compiler will cause some error messages to be displayed. Use the
editor program to make changes to your source file, and compile it again.
- When the source program is error-free, the compiler saves its
machine-language translation as an object file.
- Call the binder program (sometimes called linker) to combine
your object program with additional object files needed for your program to
execute. These may be system files such as input/output modules, or other
application modules (packages, in Ada terms) that you or others have
written. Generally, the binder needs only to be told the name of your main
program; it then proceeds to save the final result as an executable
program on disk.
To execute a program, the CPU examines each program instruction in memory and
sends out the command signals required to carry out the instruction. Although
the instructions are normally executed in sequence, as we will see later, it is
possible to have the control unit skip over some instructions or execute some
instructions more than once.
During execution, data can be entered into memory and manipulated in some
specified way. Special program instructions are used for requesting the user to
enter input data, then reading the data into memory. After some
manipulation of the input data, instructions are used for displaying or
printing result values--program output--from memory.
Figure
1.7 shows the effect of executing a payroll program stored in memory. The
first step of the program requires entering data into memory that describe the
employee. In the second step, the employee data are manipulated by the central
processor and the results of computations are stored in memory. In the final
step, the computational results may be displayed as payroll reports or employee
payroll checks.
Figure 1.7
Flow of Information During Program Execution
- What is the role of a compiler? What is a syntax error? In which file
would a syntax error be found?
- What is the difference between the source file and the object file? Which
do you create and which does the compiler create? Which one is processed by the
linker? What does the loader do?
Previous | Next | Table of Contents | Index | Program List | Copyright
Copyright © 1996 by Addison-Wesley Publishing Company, Inc.