A New Error Repair and Recovery Scheme for Lexical and Syntactic Analysis

Abstract This paper describes a two-level error repair and recovery scheme applicable to table- driven parsers and scanners. For parsers, the first level of the scheme tries to locally correct erroneous text by performing insertions, deletions and replacements of tokens around the error detection point, and matching these source modifications against an ordered list of correction models. If this local repair of text fails, a global recovery is initiated, which skips the text up to a “key terminal” and pops the parse stack. Lexical error processing is based on similar principles. The main advantages of the scheme are its power, efficiency and language independence. It can be parameterized by the grammar writer, uses the normal analysis tables and does not slow down the analysis of correct portions of text. Furthermore it can be easily implemented in automatically generated analysers such as the ones constructed by our system SYNTAX.

[1]  Martin Jourdan Strongly non-circular attribute grammars and their recursive evaluation , 1984, SIGPLAN '84.

[2]  Frank DeRemer,et al.  A forward move algorithm for LR error recovery , 1978, POPL '78.

[3]  Bernard Lorho Semantic attributes processing in the system DELTA , 1975, Methods of Algorithmic Language Implementation.

[4]  Bernard Lang,et al.  Programming Environments Based on Structured Editors: The MENTOR Experience, , 1980 .

[5]  G. David Ripley,et al.  Error recovery for Simple LR(k) parsers , 1976, ACM '76.

[6]  Richard B. Kieburtz,et al.  Global Context Recovery: A New Strategy for Syntactic Error Recovery by Table-Drive Parsers , 1980, TOPL.

[7]  Alfred V. Aho,et al.  The Theory of Parsing, Translation, and Compiling , 1972 .

[8]  Susan L. Graham,et al.  Practical syntactic error recovery , 1975, CACM.

[9]  Niklaus Wirth,et al.  Algorithms + Data Structures = Programs , 1976 .

[10]  Victor J. Rayward-Smith,et al.  A Survey on Syntactic Error Recovery and Repair , 1984, Comput. Lang..

[11]  Howard Lee Morgan,et al.  Spelling correction in systems programs , 1970, Commun. ACM.

[12]  Alfonso F. Cardenas,et al.  Doubly-Chained Tree Data Base Organisation-Analysis and Design Strategies , 1977, Comput. J..

[13]  Charles B. Haley,et al.  Practical LR error recovery , 1979, SIGPLAN '79.

[14]  Ronald Paul Leinius,et al.  Error detection and recovery for syntax directed compiler systems , 1970 .

[15]  M. Dennis Mickunas,et al.  Automatic error recovery for LR parsers , 1978, CACM.

[16]  G. David Ripley,et al.  A Statistical Analysis of Syntax Errors , 1978, Comput. Lang..

[17]  Jacques E. LaFrance,et al.  Syntax-directed error recovery for compilers , 1971 .

[18]  Roland Carl Backhouse,et al.  An Assessment of Locally Least-Cost Error Recovery , 1983, Comput. J..