Advertisement

Acta Informatica

, Volume 13, Issue 2, pp 115–139 | Cite as

Methods for the automatic construction of error correcting parsers

  • Johannes Röhrich
Article

Summary

Methods for the automatic construction of error handling parsers are presented. The resulting parsers are capable of correcting all syntax errors by insertion and/or deletion of terminal symbols to the right of the error location. Thus, the output of the parser always corresponds to a syntactically valid program. This contributes significantly to the reliability and robustness of a compiler. The speed of parsing correct parts of a program is not affected by the presence of the error handling capability. The correction algorithm is easy to implement. Apart from the parsing tables only one character per parser state is required to control the correction process. The method is applicable to a wide class of stack automata including LL(k), LR(k), SLR(k), and LALR(k) parsers. It is shown that for LL(k) grammars error correction can be obtained as a byproduct of the canonical LL(k) parser generation. A similar result can be obtained for LR(k) grammars if the parser generator is slightly modified. The method has been successfully added to an LALR(1) parser generator.

Keywords

Data Structure Communication Network Information Theory Computational Mathematic Computer System 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Aho A.V., Ullman, J.D.: The Theory of Parsing, Translation, and Compiling. Volume I. Englewood Cliffs, N.J.: Prentice Hall 1972Google Scholar
  2. 2.
    Amman, U.: Die Entwicklung eines PASCAL-Compilers nach der Methode des strukturierten Programmierens. Dissertation 54/56. ETH Zürich 1975Google Scholar
  3. 3.
    Büchi, J.R.: Regular canonical systems. Archiv für Mathematische Logik und Grundlagenforschung 6, 91–111 (1964)MathSciNetCrossRefGoogle Scholar
  4. 4.
    Dencker, P.: Ein neues LALR System. Diplomarbeit. Institut für Informatik II, Universität Karlsruhe 1977Google Scholar
  5. 5.
    DeRemer, F.L.: Simple LR(k) grammars. CACM 14, 453–460 (1971)MathSciNetCrossRefGoogle Scholar
  6. 6.
    Graham, S.L., Rhodes, S.P.: Practical syntactic error recovery. CACM 18, 639–650 (1975)CrossRefGoogle Scholar
  7. 7.
    Gries, D.: Compiler Construction for Digital Computers. New York, London: Wiley 1971zbMATHGoogle Scholar
  8. 8.
    Horning, J.J.: What the Compiler Should Tell the User. In: Compiler Construction. An Advanced Course (G. Goos, J. Hartmanis, eds.), Lecture Notes in Computer Science 21, pp. 526–548. Berlin, Heidelberg, New York: Springer 1974Google Scholar
  9. 9.
    Irons, E.T.: An Error-Correcting Parse Algorithm. CACM 6, 669–680 (1963)CrossRefGoogle Scholar
  10. 10.
    James, L.R.: A Syntax-Directed Error Recovery Method. CSRG 13. University of Toronto 1972Google Scholar
  11. 11.
    Leinius, R.P.: Error Detection and Recovery for Syntax Directed Compiler Systems. PhD Thesis. University of Wisconsin 1970Google Scholar
  12. 12.
    Levy, J.P.: Automatic Correction of Syntax Errors in Programming Languages. PhD Thesis, TR71-116. Cornell University 1971Google Scholar
  13. 13.
    Peterson, T.G.: Syntax Error Detection, Correction and Recovery in Parsers. PhD Thesis. Stevens Institute of Technology, Hoboken (N.J.) 1972Google Scholar
  14. 14.
    Röhrich, J.: Automatic Construction of Error Correcting Parsers. Dissertation, Interner Bericht Nr. 8. Fakultät für Informatik, Universität Karlsruhe 1978Google Scholar
  15. 15.
    Salomaa, A.: Formal Languages. London: Academic Press 1973zbMATHGoogle Scholar
  16. 16.
    Wynn, P.: Error recovery in SLR parsers. PhD Thesis. University of Newcastle upon Typne 1973Google Scholar

Copyright information

© Springer-Verlag 1980

Authors and Affiliations

  • Johannes Röhrich
    • 1
  1. 1.Institut für Informatik IIUniversität KarlsruheKarlsruhe 1Germany

Personalised recommendations