Skip to main content
Article thumbnail
Location of Repository

Automatic error recovery for LR parsers in theory and practice

By Julia Anne Dain


This thesis argues the need for good syntax error handling schemes in language\ud translation systems such as compilers, and for the automatic incorporation of such schemes\ud into parser-generators. Syntax errors are studied in a theoretical framework and practical\ud methods for handling syntax errors are presented.\ud The theoretical framework consists of a model for syntax errors based on the concept of\ud a minimum prefix-defined error correction,a sentence obtainable from an erroneous string by\ud performing edit operations at prefix-defined (parser defined) errors. It is shown that for an\ud arbitrary context-free language, it is undecidable whether a better than arbitrary choice of edit\ud operations can be made at a prefix-defined error. For common programming languages,it is\ud shown that minimum-distance errors and prefix-defined errors do not necessarily coincide,\ud and that there exists an infinite number of programs that differ in a single symbol only; sets\ud of equivalent insertions are exhibited.\ud Two methods for syntax error recovery are, presented. The methods are language\ud independent and suitable for automatic generation. The first method consists of two stages,\ud local repair followed if necessary by phrase-level repair. The second method consists of a\ud single stage in which a locally minimum-distance repair is computed. Both methods are\ud developed for use in the practical LR parser-generator yacc, requiring no additional\ud specifications from the user. A scheme for the automatic generation of diagnostic messages\ud in terms of the source input is presented. Performance of the methods in practice is evaluated\ud using a formal method based on minimum-distance and prefix-defined error correction. The\ud methods compare favourably with existing methods for error recovery

Topics: QA76
OAI identifier:

Suggested articles


  1. (1976). Bounds for the string editing problene',
  2. (1971). Design of a Pascal compiler", doi
  3. (1981). LR - automatic parser generator and LR(I) parser", doi
  4. (1974). Notes in Computer Science,
  5. (1968). PL360 -a programming language for the 360 computers", doi
  6. (1974). The string-to-string correction problem", doi
  7. (1977). Why automatic error correctors fail", doi

To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.