Advertisement

Acta Informatica

, Volume 7, Issue 3, pp 249–268 | Cite as

A practical general method for constructing LR(k) parsers

  • David Pager
Article

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]).

Keywords

Information System Operating System Data Structure Communication Network Information Theory 
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.: 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 1973Google 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. 1973Google Scholar
  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 1967Google 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. 1969Google 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 1962Google Scholar
  10. 10.
    Hayashi, K.: On the construction of LR(k) parsers. Proc. ACM 1971 Annual Conf., ACM, New York, pp. 538–553Google Scholar
  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. 1973Google Scholar
  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, 1971Google Scholar
  15. 15.
    McKeeman, W. M., Horning, J. J., Wortman, D. B.: A compiler generator. Englewood Cliffs (N.J.): Prentice-Hall 1970Google Scholar
  16. 16.
    Pager, D.: Some ideas for left-to-right parsing. University of Hawaii, Information Sciences Program, Tech. Report No. PE 84, Oct. 1970Google Scholar
  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. 1972Google 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. 1972Google Scholar
  21. 21.
    Pager, D.: The lane tracing algorithm for constructing LR(k) parsers and ways of enhancing its efficiency. Information Sciences (to appear)Google Scholar
  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 1974Google 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 1972Google Scholar
  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 1972Google Scholar

Copyright information

© Springer-Verlag 1977

Authors and Affiliations

  • David Pager
    • 1
  1. 1.Dept. of Information and Computer SciencesUniversity of HawaiiHonoluluUSA

Personalised recommendations