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.
Similar content being viewed by others
References
Aho, A.V., Ullman, J.D.: The theory of parsing, translation and compiling, Vol. I, II. Englewood Cliffs, N.J.: Prentice Hall 1972, 1973
Anderson, T., Eve, J., Horning, J.J.: Efficient LR(1) parsers. Acta Inf. 2, 12–39 (1973)
Brzozowska, M., Kunert, L.: A language for simulation of logic circuits. The Jagiellonian University, M.Sc. Thesis, Kraków 1979
Dencker, P., Dürre, K., Heuft, J.: Optimization of parser tables for portable compilers. ACM Toplas 6, 546–572 (1984)
DeRemer, F.L.: Simple LR(k) grammars. Commun ACM 14, 453–460 (1971)
DeRemer, F.L.: Practical translators for LR(k) languages. MIT, Cambridge, Ph.D. Thesis, 1969
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
Graham, S.L.: Precedence languages and bounded right context languages. Stanford Univ., Stanford, Calif., Ph.D. Thesis, 1971
Graham, S.L.: On bounded right context languages and grammars. SIAM J. Comput. 3, 224–254 (1974)
Graham, S.L., Rhodes, S.P.: Practical syntactic error recovery. Commun ACM 18, 639–650 (1975)
Harrison, M.A.: Introduction to Formal Language Theory. Reading, Mass.: Addison-Wesley 1978
Jensen, K., Wirth, N.: Pascal user manual and report. Lect. Notes Comput. Sci. 18. Berlin, Heidelberg, New York: Springer 1976
Knuth, D.E.: On the translation of languages from left to right. Inf Control 8, 607–639 (1965)
Król, J., Wyrostek, P.: Some error recovery method for precedence parsers (in Polish). Podstawy Sterowania 10, 93–108 (1980)
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
Learner, A., Lim, A.L.: A note on transforming context-free grammars to Wirth-Weber precedence form. Comput. J. 13, 142–144 (1970)
Levy, J.P.: Automatic correction of syntax errors in programming languages. Cornell Univ., Ph.D. Thesis, TR71-116, 1971
McAfee, J., Presser, L.: An algorithm for the design of simple precedence grammars. J. ACM 19, 385–395 (1972)
McKeeman, W.M., Horning, J.J., Wortman, D.B.: A compiler generator. Englewood Cliffs. N.J.: Prentice Hall 1970
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)
Moll, K.R.: Left context precedence grammars. Acta Inf. 14, 317–335 (1980)
Rhodes, S.P.: Practical syntactic error recovery for programming languages. Univ. of California, Ph.D. Thesis, 1973
Snock, T., Bass, C., Roberts, J., Nahapetian, A., Fay, M.: Report on the programming language PLZ/SYS. Berlin, Heidelberg, New York: Springer 1978
Wirth, N., Weber, H.: Euler — a generalization of Algol and its formal definition. Commun ACM 9, 11–23, 89–99 (1966)
Witaszek, J.: Construction and optimization of LR(k) parsers (in Polish). Prace Naukowo-Badawcze IMM, Warszawa 1979
Wyrostek, P.: Another view on the correct prefix property in precedence parsers. The Jagiellonian University, Dept. of Comp. Sci., Report 6, 1982
Wyrostek, P.: On the correct prefix property in precedence parsers. Inf. Process. Lett. 17, 161–165 (1983)
Wyrostek, P.: SLR(1), LALR(1) and the most common grammar transformations. (In preparation)
Author information
Authors and Affiliations
Rights 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
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00267864