Technical Report CS0322

Title: Automatic Generation of Useful Syntax Error Messages
Authors: E. Kanotoriwitz and H. Laor
Abstract: Many current compilers ptoduce in some situations wrong error messages that mislead the user and harm his confidence in the system. It is demonstrated that a reliable and efficient syntax -error handling system may be produced automatically by a compiler generator from the BNF specification of the language, and without any effort by tne language implementor. This result is achieved in three ways:

(a) Some errors may not be diagnozed without knowledge of the intentions of the programmer. Some, compilers employ a sophisticated analysis that attempts to capture these intentions, but which are not always successful. Such an elaborate analysis is not employed here, and instead a list of all the legal corrections is displayed, such that the programmer may readily select the right one.

(b) The recovery symbols are selected by a "careful" algorithm resulting in a high probability for correct error recovery.

(c) The "honest" error messages show also the parts of the code which could not be analyzed correctly because of errors, ,and where more errors may exist. Effiiciency is achieved by computing the recovery sets once and for ever at compiler generation time, such that a fast error recovery at program compilation time is achieved. Experiments with erroneous programs suggest that the method compares well with the best cmpilers that we have seen, and is specially good in avoidance of wrong error messages.

CopyrightThe above paper is copyright by the Technion, Author(s), or others. Please contact the author(s) for more information

Remark: Any link to this technical report should be to this page (, rather than to the URL of the PDF files directly. The latter URLs may change without notice.

To the list of the CS technical reports of 1984
To the main CS technical reports page

Computer science department, Technion