Described is a method for syntactic error recovery that is compatible with deterministic parsing methods and that is able to recover from many errors more quickly than do other schemes because it performs global context recovery. The method relies on fiducial symbols, which are typically reserved key words of a language, to provide mileposts for error recovery. The method has been applied to LL(1) parsers, for which a detailed algorithm is given, and informally proved correct. The algorithm will always recover and return control to the parser if the text being analyzed satisfies only minimal requirements: that it contains one or more occurrences of fiducial symbols following the point at which an error is detected. Tables needed for error recovery have been automatically generated, along with parsing tables, by a parser constructor for the LL(1) grammars.
A theoretical characterization of fiducial symbols is given, and the utility of this characterization in practice is discussed. It has been applied to a grammar for the programming language Pascal to aid in selection of a set of fiducial symbols. The error recovery scheme has been tested on a set of student-written Pascal program texts and is compared with other error recovery strategies.
[1]
Charles N. Fischer,et al.
An efficient insertion-only error-corrector for LL(1) parsers
,
1977,
POPL.
[2]
Urs Ammann.
Error recovery in recursive descent parsers
,
1978
.
[3]
Gordon Lyon,et al.
Syntax-directed least-errors analysis for context-free languages
,
1974,
Commun. ACM.
[4]
Ajit Babani Pai.
Syntax driven error recovery in top-down parsing.
,
1978
.
[5]
Frank DeRemer,et al.
A forward move algorithm for LR error recovery
,
1978,
POPL '78.
[6]
Charles B. Haley,et al.
Practical LR error recovery
,
1979,
SIGPLAN '79.
[7]
Alfred V. Aho,et al.
A Minimum Distance Error-Correcting Parser for Context-Free Languages
,
1972,
SIAM J. Comput..
[8]
Susan L. Graham,et al.
Practical syntactic error recovery
,
1975,
CACM.
[9]
G. David Ripley,et al.
A Statistical Analysis of Syntax Errors
,
1978,
Comput. Lang..
[10]
Kuo-Chung Tai,et al.
Syntactic Error Correction in Programming Languages
,
1978,
IEEE Trans. Software Eng..
[11]
M. Dennis Mickunas,et al.
Automatic error recovery for LR parsers
,
1978,
CACM.