Acta Informatica

, Volume 2, Issue 1, pp 12–39 | Cite as

EfficientLR (1) parsers

  • T. Anderson
  • J. Eve
  • J. J. Horning
Article

Summary

Knuth'sLR(1) parsing algorithm is sufficiently general to handle the parsing of most programming languages with the additional benefit of earlier detection of syntax errors than in other formal methods used in compilers. The major obstacle impeding the use of this algorithm is the large space requirement for parsing tables. In addition, certain optimisations described here, which increase parsing speed, exacerbate the space problem.

Two approaches for overcoming this problem are explored.
  1. 1.

    Using parsers related to theLR(1) parser which parse a large subset of theLR(1) grammars, but which have much smaller parsing tables.

     
  2. 2.

    Devising compact encodings and performing space optimisations on these tables.

     

Time and space efficiency is evaluated using the Stanford University Algol W compiler as a base for comparison since the parsing routine in this compiler is among the more efficient presently used.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Anderson, T.: Syntactic analysis ofLR(k) languages. Ph. D. Thesis (1972), University of Newcastle upon Tyne.Google Scholar
  2. DeRemer, F. L.: Practical translators forLR(k) languages. Ph.D.Thesis 1969, Department of Electrical Engineering, M.I.T.Google Scholar
  3. DeRemer, F. L.: SimpleLR(k) grammars. CACM14, 453–460 (1971).Google Scholar
  4. Earley, J.: An efficient context free parsing algorithm. CACM13, 94–102 (1970).Google Scholar
  5. Feldman, J. R., Gries, D.: Translator writing systems. CACM11, 77–113 (1968).Google Scholar
  6. Knuth, D. E.: On the translation of languages from left to right. Information and Control8, 607–639 (1965).Google Scholar
  7. Korenjak, A.: A practical method for constructingLR(k) processors. CACM12, 613–623 (1969).Google Scholar
  8. Lalonde, W.R.: An efficient LALR parser generator. Tech. Rep. CSRG-2 (1971), University of Toronto.Google Scholar
  9. Lewis, P.M., Stearns, R.E.: Syntax directed transduction. JACM15, 465–488 (1968).Google Scholar
  10. McKeeman, W.M., Horning, J.J., Wortman, D.B.: A compiler generator. Prentice Hall 1970.Google Scholar
  11. Pager, D.: A solution to an open problem by Knuth. Information and Control14, 462–473 (1970).Google Scholar
  12. Wirth, N.: PL 360, a programming language for the 360 computers. JACM15, 37–74 (1968).Google Scholar
  13. Wirth, N., Hoare, C.A.R.: A contribution to the development ofAlgol. CACM9, 413–432 (1966).Google Scholar
  14. Wirth, N., Weber, H.:Euler: A generalisation ofAlgol, and its formal definition: Part I. CACM9, 13–23 (1966).Google Scholar

Copyright information

© Springer-Verlag 1973

Authors and Affiliations

  • T. Anderson
    • 1
  • J. Eve
    • 1
  • J. J. Horning
    • 2
  1. 1.Computing Laboratory The UniversityNewcastle upon TyneEngland
  2. 2.Department of Computer ScienceUniversity of TorontoTorontoCanada

Personalised recommendations