An efficient and systematic LL(1) error recovery method is presented that has been implemented for an LL(1) parser generator. Error messages which provide good diagnostic information are generated automatically. Error correction is done by discarding some input symbols and popping up some symbols from the parsing‐stack in order to restore the parser to a valid configuration. Thus, symbol deletions and insertions are simulated. The choice between different possible corrections is made by comparing the cost of the inserted (popped) symbols with the reliability value of the recovery symbol (the first input symbol that is not discarded). Our concept of reliability is based on the observation that input symbols differ from each other in their ability to serve as recovery points. A high reliability value of a symbol asserts that it was probably not placed in the input by accident. So it is reasonable not to discard that symbol but to resume parsing. This is done even if a string with high insert‐cost has to be inserted before that symbol in order to fit it to the part of the program that has already been analysed. The error recovery routine is invoked only when an error is detected. Thus, there is no additional time required for parsing correct programs. Error‐correcting parsers for different languages, including Pascal, have been generated. Some experimental results are summarized.
[1]
Charles B. Haley,et al.
Practical LR error recovery
,
1979,
SIGPLAN '79.
[2]
Carlo Ghezzi.
LL(1) Grammars Supporting an Efficient Error Handling
,
1975,
Inf. Process. Lett..
[3]
Johannes Röhrich.
Behandlung syntaktischer Fehler
,
1982,
Inform. Spektrum.
[4]
G. David Ripley,et al.
A Statistical Analysis of Syntax Errors
,
1978,
Comput. Lang..
[5]
h. c. Niklaus Wirth.
Die Behandlung von syntaktischen Fehlern
,
1984
.
[6]
Susan L. Graham,et al.
Practical syntactic error recovery
,
1975,
CACM.
[7]
Charles N. Fischer,et al.
Immediate Error Detection in Strong LL(1) Parsers
,
1979,
Inf. Process. Lett..
[8]
Karl-Rudolf Moll.
Suffixanalyse, ein Konzept zur Behandlung von syntaktischen Fehlern
,
1981,
Inform. Spektrum.
[9]
Jerome A. Feldman,et al.
Translator writing systems
,
1968,
Commun. ACM.
[10]
Charles N. Fischer,et al.
Efficient LL(1) error correction and recovery using only insertions
,
1980,
Acta Informatica.
[11]
B KieburtzRichard,et al.
Global Context Recovery: A New Strategy for Syntactic Error Recovery by Table-Drive Parsers
,
1980
.