Unformatted text preview: o eliminate because almost all language processors
are designed to detect syntax errors. The language processors print error messages
on the source listing of a program that indicate each program statement with errors
and give hints as to the nature of the error. These error messages are very useful
and are used by the programmers to rectify all syntax errors in their programs.
Thus, it is a relatively easy task to detect and correct syntax errors.
It should be noted that in high-level languages, such as FORTRAN and COBOL, a
single error often causes multiple error messages to be generated. There are two
reasons for multiple error messages. One is that high-level language instructions
often require multiple machine steps. The other reason is that symbolic
instructions are often dependent upon other instructions and if an instruction
containing an error is one that defines a field name, all instructions in the program
using that field name will be listed as errors. The error message will say that a
field being used is not a defined name. In such a case, removal of the single error
will result in the removal of all associated error messages. Debugging a Program for Logic Errors
Unlike syntax errors, the computer does not produce any error message for logic
errors in a program. Hence logic errors are much more difficult to eliminate than
syntax errors. However, once the testing of a program indicates the presence of
logic error in it, one or more of the following methods may be used to locate and
correct logic errors.
Doing Hand Simulation of the Program Code
One approach is to take a printout of the source code of the program and go
through its execution manually with the test data input that produced incorrect
results. In the manual execution, you follow the same sequence of paths, which the
computer would have followed for the test data keeping track of the changes in the
values of the various variables that you come across during the execution. The
cause of the problem is very...
View Full Document
This document was uploaded on 04/07/2014.
- Spring '14