Skip to main content
Log in

Precedence technique is not worse than SLR(1)

  • Published:
Acta Informatica Aims and scope Submit manuscript

Summary

The paper describes a transformation which converts SLR(1) grammars to grammars which are (1, 0) or (1, 1) mixed strategy precedence grammars and which have the correct prefix property. The transformation is first of all practical. The increase of a grammar size caused by the transformation is so moderate that often a smaller parser can be obtained as the final result.

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.

Similar content being viewed by others

References

  1. Aho, A.V., Ullman, J.D.: The theory of parsing, translation and compiling, Vol. I, II. Englewood Cliffs, N.J.: Prentice Hall 1972, 1973

    Google Scholar 

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

    Google Scholar 

  3. Brzozowska, M., Kunert, L.: A language for simulation of logic circuits. The Jagiellonian University, M.Sc. Thesis, Kraków 1979

    Google Scholar 

  4. Dencker, P., Dürre, K., Heuft, J.: Optimization of parser tables for portable compilers. ACM Toplas 6, 546–572 (1984)

    Google Scholar 

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

    Google Scholar 

  6. DeRemer, F.L.: Practical translators for LR(k) languages. MIT, Cambridge, Ph.D. Thesis, 1969

    Google Scholar 

  7. Geller, M.M., Graham, S.L., Harrison, M.A.: Production prefix parsing. In: Automata, languages and programming, 2nd Colloquium, Lect. Notes Comput. Sci. 14, pp. 232–242. Berlin, Heidelberg, New York: Springer 1974

    Google Scholar 

  8. Graham, S.L.: Precedence languages and bounded right context languages. Stanford Univ., Stanford, Calif., Ph.D. Thesis, 1971

    Google Scholar 

  9. Graham, S.L.: On bounded right context languages and grammars. SIAM J. Comput. 3, 224–254 (1974)

    Google Scholar 

  10. Graham, S.L., Rhodes, S.P.: Practical syntactic error recovery. Commun ACM 18, 639–650 (1975)

    Google Scholar 

  11. Harrison, M.A.: Introduction to Formal Language Theory. Reading, Mass.: Addison-Wesley 1978

    Google Scholar 

  12. Jensen, K., Wirth, N.: Pascal user manual and report. Lect. Notes Comput. Sci. 18. Berlin, Heidelberg, New York: Springer 1976

    Google Scholar 

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

    Google Scholar 

  14. Król, J., Wyrostek, P.: Some error recovery method for precedence parsers (in Polish). Podstawy Sterowania 10, 93–108 (1980)

    Google Scholar 

  15. Lalonde, W.R., Lee, E.S., Horning, J.J.: An LALR(k) parser generator. Proc. IFIP Congress 1971, Ljubliana, pp. 153–157. Amsterdam: North-Holland 1971

    Google Scholar 

  16. Learner, A., Lim, A.L.: A note on transforming context-free grammars to Wirth-Weber precedence form. Comput. J. 13, 142–144 (1970)

    Google Scholar 

  17. Levy, J.P.: Automatic correction of syntax errors in programming languages. Cornell Univ., Ph.D. Thesis, TR71-116, 1971

  18. McAfee, J., Presser, L.: An algorithm for the design of simple precedence grammars. J. ACM 19, 385–395 (1972)

    Google Scholar 

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

    Google Scholar 

  20. Mickunas, D.M., Lancaster, R.L., Schneider, V.B.: Transforming LR(k) grammars to LR(1), SLR(1), and (1, 1) bounded right context grammars. J. ACM 23, 511–533 (1976)

    Google Scholar 

  21. Moll, K.R.: Left context precedence grammars. Acta Inf. 14, 317–335 (1980)

    Google Scholar 

  22. Rhodes, S.P.: Practical syntactic error recovery for programming languages. Univ. of California, Ph.D. Thesis, 1973

  23. Snock, T., Bass, C., Roberts, J., Nahapetian, A., Fay, M.: Report on the programming language PLZ/SYS. Berlin, Heidelberg, New York: Springer 1978

    Google Scholar 

  24. Wirth, N., Weber, H.: Euler — a generalization of Algol and its formal definition. Commun ACM 9, 11–23, 89–99 (1966)

    Google Scholar 

  25. Witaszek, J.: Construction and optimization of LR(k) parsers (in Polish). Prace Naukowo-Badawcze IMM, Warszawa 1979

    Google Scholar 

  26. Wyrostek, P.: Another view on the correct prefix property in precedence parsers. The Jagiellonian University, Dept. of Comp. Sci., Report 6, 1982

  27. Wyrostek, P.: On the correct prefix property in precedence parsers. Inf. Process. Lett. 17, 161–165 (1983)

    Google Scholar 

  28. Wyrostek, P.: SLR(1), LALR(1) and the most common grammar transformations. (In preparation)

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Wyrostek, P. Precedence technique is not worse than SLR(1). Acta Informatica 23, 361–392 (1986). https://doi.org/10.1007/BF00267864

Download citation

  • Received:

  • Issue Date:

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

Keywords

Navigation