PDF

Description

Good error recovery for compilers depends on accurate diagnosis of errors. When an error is misdiagnosed, the error message issued for it is apt to be misleading. Worse, the error recovery system may leave the compiler in a configuration that will cause spurious errors to be reported later. This dissertation presents new error recovery techniques for compilers that generally diagnose errors more accurately than earlier techniques.

The major innovation embodied in the new error recovery techniques is the use of general static semantic information to help detect and diagnose syntactic errors. There are usually many possible ways of recovering from an error. Testing if a potential recovery leads to semantic problems later involves executing the semantic actions associated with that recovery. If a potential recovery is rejected, the semantic actions that were performed while testing it must have no apparent effect on later compilation. Thus, it must be possible to undo the effects of semantic actions. For conventional compilers, the mechanisms needed to reverse the effects of semantic actions are too slow to be practical. A new compiler organization that permits semantic actions to be undone efficiently is presented. This new organization is suited for compiling languages, such as C, Pascal, and Ada, that require declarations to precede uses.

Two further ways of improving the performance of error recovery systems are considered. Error recovery systems sometimes fail to accurately diagnose an error because the parser has performed reductions based on erroneous input. A variety of techniques for avoiding the adverse effects of such reductions are presented and compared. Also, a new panic mode algorithm for use with LR parsers is presented.

The new error recovery techniques have been applied in an error checking program for Pascal. The recoveries produced by that program are shown to compare favorably with those produced by two well known error recovery systems. Finally, some drawbacks of the new techniques and some directions for future work are discussed.

Details

Files

Statistics

from
to
Export
Download Full History