A practical general method for constructing LR(k) parsers

Summary

The paper presents in detail the case for k=1 of a practical general method for constructing LR(k) parsers. For k=1 this method is of rival efficiency to the previous general algorithm described by the author in [21]. The method involves combining the states of an LR(k) parser as they are generated, reducing to a fraction, in the process, the number of configurations that need actually be evaluated, or for which space must be assigned — compared to such general methods as those of [1, 11, 12, 17]. The criteria of compatibility introduced for this purpose are such that the parser obtained is in practice identical in size to, or negligibly larger than, that obtained by resolving the inadequacies of an LR(o) parser (as is done for various subsets of the LR(k) grammars in [5, 8, 14, 20]).

This is a preview of subscription content, access via your institution.

References

  1. 1.

    Aho, A. V., Ullman, J. D.: Optimization of LR(k) parsers. J. Computer and System Sciences 6, 573–602 (1972)

    Google Scholar 

  2. 2.

    Aho, A. V., Ullman, J. D.: A technique for speeding up LR(k) parsers. SIAM J. Computing 2, 106–127 (1973)

    Google Scholar 

  3. 3.

    Aho, A. V., Ullman, J. D.: The theory of parsing, translation, and compiling. Englewood Cliffs (N.J.): Prentice-Hall 1973

    Google Scholar 

  4. 4.

    Aho, A. V., Johnson, S. C., Ullman, J. D.: Deterministic parsing of ambiguous grammars. Proc. ACM Symposium on Principles of Programming Languages, Boston, Mass., Oct. 1973

  5. 5.

    Anderson, T., Eve, J., Horning, J. J.: Efficient LR(1) parsers. Acta Informatica 2, 12–39 (1973)

    Google Scholar 

  6. 6.

    Booth, T. L.: Sequential machines and automata theory. New York: Wiley 1967

    Google Scholar 

  7. 7.

    DeRemer, F. L.: Practical translators for LR(k) languages. Mass. Inst. of Tech., Cambridge (Mass.), Project MAC, Tech. Rep. MAC TR-65, Oct. 1969

    Google Scholar 

  8. 8.

    DeRemer, F. L.: Simple LR(k) grammars. Comm. ACM 14, 453–460 (1971)

    Google Scholar 

  9. 9.

    Ginsburg, S.: An introduction to mathematical machine theory. Reading (Mass.): Addison-Wesley 1962

    Google Scholar 

  10. 10.

    Hayashi, K.: On the construction of LR(k) parsers. Proc. ACM 1971 Annual Conf., ACM, New York, pp. 538–553

  11. 11.

    Joliat, M. L.: On the reduced matrix representation of LR(k) parser tables. Computer Systems Research Group, University of Toronto, Tech. Report CSRG-28, Oct. 1973

  12. 12.

    Knuth, D. E.: On the translation of languages from left to right. Information and Control 8, 607–639 (1965)

    Google Scholar 

  13. 13.

    Korenjak, A. J.: A practical method for constructing LR(k) processors. Comm. ACM 12, 613–623 (1969)

    Google Scholar 

  14. 14.

    LaLonde, W. R.: An efficient LALR parser generator. Computer Systems Research Group, University of Toronto, Tech. Report CSRG-2, 1971

  15. 15.

    McKeeman, W. M., Horning, J. J., Wortman, D. B.: A compiler generator. Englewood Cliffs (N.J.): Prentice-Hall 1970

    Google Scholar 

  16. 16.

    Pager, D.: Some ideas for left-to-right parsing. University of Hawaii, Information Sciences Program, Tech. Report No. PE 84, Oct. 1970

  17. 17.

    Pager, D.: A solution to an open problem by Knuth. Information and Control 17, 462–473 (1970)

    Google Scholar 

  18. 18.

    Pager, D.: Conditions for the existence of minimal closed covers composed of maximal compatibles. IEEE Trans. Computers C-20, 450–452 (1971)

    Google Scholar 

  19. 19.

    Pager, D.: Efficient programming techniques for LR(k) parsing. Proc. Seventh Annual Princeton Conf. on Information Sciences and Systems, Princeton University, Princeton, 1973; University of Hawaii, Information Sciences Program, Tech. Report No. PE 236, Jan. 1972

    Google Scholar 

  20. 20.

    Pager, D.: On the incremental approach to left-to-right parsing. University of Hawaii, Information Sciences Program, Tech. Report No. PE 238, Jan. 1972

  21. 21.

    Pager, D.: The lane tracing algorithm for constructing LR(k) parsers and ways of enhancing its efficiency. Information Sciences (to appear)

  22. 22.

    Pager, D.: On eliminating unit productions from LR(k) parsers. In: Loeckx, J. (ed.), Automata, languages, and programming, 2nd Colloquium. Lecture Notes in Computer Science 14. Berlin-Heidelberg-New York: Springer 1974

    Google Scholar 

  23. 23.

    Pager, D.: A compaction algorithm for combining the symbol-action lists of an LR(k) parser. University of Hawaii, Information Sciences Program, Tech. Report No. PE 259, July 1972

  24. 24.

    Pager, D.: On the decremental approach to left-to-right parsing. University of Hawaii, Information Sciences Program, Tech. Report No. PE 252, July 1972

Download references

Author information

Affiliations

Authors

Additional information

This paper is a development of one of the ideas proposed in Pager [16]. The work was supported by the National Science Foundation under Grant GJ-43362.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Pager, D. A practical general method for constructing LR(k) parsers. Acta Informatica 7, 249–268 (1977). https://doi.org/10.1007/BF00290336

Download citation

Keywords

  • Information System
  • Operating System
  • Data Structure
  • Communication Network
  • Information Theory