A language independent error recovery method for LL(1) parsers
1984, Software: Practice and Experience
https://doi.org/10.1002/SPE.4380141107Abstract
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...
References (17)
- B. W. Pollack (ed).), Compiler Techniques, Auerbach Publishers, Philadelphia 1972.
- J . Feldman and D. Gries, 'Translator writing systems' CACM, 11 (2), 77-113 (1968).
- N. Wirth, 'Die Behandlung von syntaktischen Fehlern', in Compilerbau, Teubner-Verlag, 1977.
- Karl-Rudolf Moll, 'Suffixanalyse, ein Konzept zur Behandlung von syntaktischen Fehlern', Informatik Spektrum 4, 82-89 (1981).
- C. N. Fischer, D. R. Milton and S. B. Quiring, 'Efficient LL(1) error-correction and recovery using
- A. B. Pai and R. B. Kieburtz, 'Global context recovery: a new strategy for syntactic error recovery by
- S. L. Graham and S. P. Rhodes, 'Practical syntactic error recovery', CACM, 1 8 ( l l ) , 639-650
- S. L. Graham, C. B. Haley and W. N. Joy, 'Practical LR error recovery', S I G P L A N Notices,
- J. Lewi, K. De Vlaminck, J. Huens and M. Huybrechts, 'The ELL(1) parser generator and the error only insertions', Acta Informatica, 13 (2), 141-154 (1980). table-driven parsers', A C M T O P L A S , 2 (l), 18-41 (1980).
- 14(18), 168-175 (1979). recovery mechanism', Acta Informatica, 10, 209-228 (1978).
- Johannes Rohrich, 'Behandlung syntaktischer Fehler', Inforrnatik Spektrum, 5 , 174184 (1982).
- G. D. Ripley and F. C. Druseikis, 'A statistical analysis of syntax errors', Computer Lunguuges,'3 (4),
- A. V. Aho and J. D. Ullman, Principles of Compiler Design,' Chap. 1 1 'Error detection and recovery', Addison-Wesley, 1977, pp. 382-405.
- C. N. Fischer, K. C. Tai and D. R. Milton, 'Immediate error detection in strong LL(1) parsers', Information Processing Letters, Vol. 8 (S), 261-266, (1979).
- C. Ghezzi, 'LL( 1)-grammars supporting an efficient error handling', Information Processing Letters, 3 (6), 174-176 (1975).
- D. Gries, Compiler Construction for Digital Computers, Chap. 1 5 'Error recovery', Wiley, 1971, pp. 314-326.
- C. Beilken, F. Mattern and M. Spenke, 'Bibliography of error handling in compilers'. University of Kaiserslautern, internal report. The very extensive bibliography (more than 200 titles) contains abstracts and cross references and can be obtained from F. Mattern. 227-239 (1978).