This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ng one or more errors detected by the compiler will not
be compiled into an object program. In this case, the compiler will generate a list
of coded error messages indicating the type of errors committed. This error list is
an invaluable aid to the programmer in correcting the program errors. As shown in
Figure 12.10, the programmer uses this error list to re-edit the source program for
removing the errors and creates a modified source program that is recompiled. As
shown in the figure, the process of editing the source program to make necessary
corrections and recompiling the modified source program is repeated over and
over again until the source program is free of all syntax errors. Also notice from
the figure that the compiler generates the object program only when there are no
syntax errors in the source program.
A compiler, however, cannot detect logic errors. It can only detect grammatical
(syntax errors) in the source program. It cannot know ones intentions. For
example, if one has wrongly entered -25 as the age of a person, when he/she
actually intended +25, the compiler cannot detect this. Programs containing such
errors will be successfully compiled and the object code will be obtained without
any error message. However, such programs, when executed, will not produce
correct results. So logic errors are detected only after the program is executed and
the result produced does not tally with the desired result.
Edit source program
Compile source program
Syntax errors detected?
Generate object program
Generate list of coded error messages
Edit source program
Figure 12.10. Illustrating recompilation of a source program until it is free of all
Linker A software often consists of several thousands, even several millions, of lines of
program code. For software of this size, it is impractical to store all the lines of
program code in a single source program file due to the following reasons:
1. The large size of the file would make it very difficult, if not impossible, to
work with. For example, it might not be possible to load the file for compilation...
View Full Document
This document was uploaded on 04/07/2014.
- Spring '14