Skip to main content
Log in

Error detection in precedence parsers

  • Published:
Mathematical systems theory Aims and scope Submit manuscript

Abstract

We consider methods by which a precedence matrix may be modified without severely degrading the error-detecting capability of a parser utilizing the matrix. Two different definitions of “the same” error detection capability are considered. The first, called “exact equivalence”, permits only useless parts of the precedence matrix to be modified. The second, called simply “equivalence”, allows the modified matrix to perform some reductions, but never to shift an input symbol, after the original has detected an error.

We give necessary and sufficient conditions for a modified precedence parser to be equivalent or exactly equivalent to the canonical parser. We then consider the interesting case where the modification is caused by replacing the precedence matrix by linear precedence functions. A simple algorithm to find (if they exist) exactly equivalent linear precedence functions for a given precedence matrix is presented.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. N. Wirth andH. Weber, Euler—a generalization ofAlgol and its formal definition I,J. Assoc. Comput. Mach. 9 (1966), 13–25.

    Google Scholar 

  2. N. Wirth, PL360, a programming language for the 360 computers,J. Assoc. Comput. Mach. 15 (1968), 37–74.

    Google Scholar 

  3. R. P. Leinius,Error Detection and Recovery for Syntax Directed Compiler Systems, Ph.D. Thesis, University of Wisconsin, Madison, Wisconsin, 1970.

    Google Scholar 

  4. R. W. Floyd, Syntactic analysis and operator precedence,J. Assoc. Comput. Mach. 10 (1963), 316–333.

    Google Scholar 

  5. J. R. Bell, A new method for determining linear precedence functions for precedence grammars,Comm. Assoc. Comput. Mach. 12 (1969), 567–569.

    Google Scholar 

  6. D. F. Martin, A Boolean matrix method for the computation of linear precedence functions,Comm. Assoc. Comput. Mach. 15 (1972), 448–454.

    Google Scholar 

  7. A. V. Aho andJ. D. Ullman, “Linear Precedence Functions for Weak Precedence Grammars”,Internat. J. Comput. Math. (to appear).

  8. A. V. Aho andJ. D. Ullman,The Theory of Parsing, Translation and Compiling, Prentice Hall, Englewood Cliffs, New Jersey, 1972.

    Google Scholar 

  9. A. J. Korenjak, A practical method for constructingLR(k) processors,Comm. Assoc. Comput. Mach. 12 (1969), 613–623.

    Google Scholar 

  10. F. DeRemer,Practical Translators for LR(k) Languages, Project MAC Report MAC TR-65, Cambridge, Mass., October 1969. (Cf. also “SimpleLR(k) grammars”,Comm. Assoc. Comput. Mach. 14 (1971), 453–460.)

    Google Scholar 

  11. A. V. Aho andJ. D. Ullman, Optimization ofLR(k) parsers,J. Computer System Sci., to appear.

  12. W. M. McKeeman, J. J. Horning andD. B. Wortman,A Compiler Generator, Prentice Hall, Englewood Cliffs, New Jersey, 1970.

    Google Scholar 

  13. A. V. Aho, P. J. Denning andJ. D. Ullman, Weak and mixed strategy precedence parsing,J. Assoc. Comput. Mach. 19 (1972), 225–242.

    Google Scholar 

  14. J. D. Ichbiah andS. P. Morse, A technique for generating almost optimal Floyd-Evans Productions for precedence grammars,Comm. Assoc. Comput. Mach. 13 (1970), 501–508.

    Google Scholar 

  15. J. N. Gray,Precedence Parsers for Programming Languages, Ph.D. Thesis, University of California, Berkeley, Calif., 1969.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Additional information

The work by this author was partially supported by NSF grant GJ-465.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Aho, A.V., Ullman, J.D. Error detection in precedence parsers. Math. Systems Theory 7, 97–113 (1973). https://doi.org/10.1007/BF01762230

Download citation

  • Received:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01762230

Keywords

Navigation