Skip to main content
Log in

A method for transforming grammars into LL(k) form

  • Published:
Acta Informatica Aims and scope Submit manuscript

Summary

A new method for transforming grammars into equivalent LL(k) grammars is studied. The applicability of the transformation is characterized by defining a subclass of LR(k) grammars, called predictive LR(k) grammars, with the property that a grammar is predictive LR(k) if and only if the corresponding transformed grammar is LL(k). Furthermore, it is shown that deterministic bottom-up parsing of a predictive LR(k) grammar can be done by the LL(k) parser of the transformed grammar. This parsing method is possible since the transformed grammar always ‘left-to-right covers’ the original grammar. The class of predictive LR(k) grammars strictly includes the class of LC(k) grammars (the grammars that can be parsed deterministically in the left-corner manner). Thus our transformation is more powerful than the one previously available, which transforms LC(k) grammars into LL(k) form.

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: Parsing. Englewood Cliffs, N.J.: Prentice-Hall 1972

    Google Scholar 

  2. Aho, A.V., Ullman, J.D.: The Theory of Parsing, Translation, and Compiling, Vol. II: Compiling. Englewood Cliffs, N.J.: Prentice-Hall 1973

    Google Scholar 

  3. Brosgol, B.M.: Deterministic translation grammars. Harvard University, Cambridge, Mass., Ph.D. Thesis, 1974

    Google Scholar 

  4. Burge, W.H.: Recursive Programming Techniques. Reading, Mass.: Addison-Wesley 1975

    Google Scholar 

  5. Cheatham, T.E., Jr.: The Theory and Construction of Compilers. Wakefield, Mass.: Computer Associates 1967

    Google Scholar 

  6. Demers, A.: Generalized left corner parsing. Conf. Record of the Fourth ACM Symposium on Principles of Programming Languages, pp. 170–182 (1977)

  7. Foster, J.M.: A syntax improving program. Comput. J. 11, 31–34 (1968)

    Google Scholar 

  8. Greibach, S.A.: A new normal-form theorem for context-free phrase structure grammars. J. Assoc. Comput. Mach. 12:1, 42–52 (1965)

    Google Scholar 

  9. Griffiths, M.: LL(1) grammars and analysers. In: Compiler Construction: An Advanced Course, Lecture Notes in Computer Science, Vol. 21 (F.L. Bauer, J. Eickel, eds.), pp. 57–84. Berlin-Heidelberg-New York: Springer 1974

    Google Scholar 

  10. Griffiths, T.V., Petrick, S.R.: On the relative efficiencies of context-free grammar recognizers. Comm. ACM. 8, 289–300 (1965)

    Google Scholar 

  11. Griffiths, T.V., Petrick, S.R.: Top-down versus bottom-up analysis. In: Proc. of the IFIP congress 68, Vol. 1 (A.J.H. Morrell, ed.), pp. 80–85. Amsterdam: North-Holland 1969

    Google Scholar 

  12. Hammer, M.: A new grammatical transformation into deterministic top-down form. MIT, Mass., Project MAC Technical Report TR-119, 1974

    Google Scholar 

  13. Hammer, M.: A new grammatical transformation into LL(k) form. Proc. of Sixth Annual ACM Symposium on Theory of Computing, pp. 266–275 (1974)

  14. Hopgood, F.R.A.: Compiling Techniques. New York, N.Y.: American Elsevier 1969

    Google Scholar 

  15. Irons, E.T.: A syntax directed compiler for ALGOL 60. Comm. ACM. 4, 51–55 (1961)

    Google Scholar 

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

    Google Scholar 

  17. Knuth, D.E.: Top-down syntax analysis. Acta Informat. 1, 79–110 (1971)

    Google Scholar 

  18. Komor, T.: A note on left factored languages. Comput. J. 17, 242–244 (1974)

    Google Scholar 

  19. Kurki-Suonio, R.: On top-to-bottom recognition and left recursion. Comm. ACM. 9, 527–528 (1966)

    Google Scholar 

  20. Kurki-Suonio, R.: Notes on top-down languages. BIT 9, 225–238 (1969)

    Google Scholar 

  21. Lewis, P.M., II, Rosenkrantz, D.J., Stearns, R.E.: Compiler Design Theory. Reading, Mass.: Addison-Wesley 1976

    Google Scholar 

  22. Lewis, P.M., II, Stearns, R.E.: Syntax directed transduction. J. Assoc. Comput. Mach. 15, 464–488 (1968)

    Google Scholar 

  23. Nijholt, A.: On the covering of left-recursive grammars. Conf. Record of the Fourth ACM Symposium on Principles of Programming Languages, pp. 86–96 (1977)

  24. Rosenkrantz, D.J.: Matrix equations and normal forms for context-free grammars. J. Assoc. Comput. Mach. 14, 501–507 (1967)

    Google Scholar 

  25. Rosenkrantz, D.J., Lewis, P.M., II: Deterministic left corner parsing. IEEE Conf. Record of 11th Annual Symposium on Switching and Automata Theory, pp. 139–152 (1970)

  26. Rosenkrantz, D.J., Stearns, R.E.: Properties of deterministic top-down grammars. Information and Control 17, 226–256 (1970)

    Google Scholar 

  27. Soisalon-Soininen, E.: Characterization of LL(k) languages by restricted LR(k) grammars. Department of Computer Science, University of Helsinki, Helsinki, Report A-1977-3, 1977

    Google Scholar 

  28. Soisalon-Soininen, E., Ukkonen, E.: A characterization of LL(k) languages. In: Automata, Languages and Programming, Third Colloquium (S. Michaelson, R. Milner, eds.), pp. 20–30. Edinburgh: Edinburgh University Press 1976

    Google Scholar 

  29. Stearns, R.E.: Deterministic top-down parsing. Proc. Fifth Annual Princeton Conf. on Information Sciences and Systems, pp. 182–188 (1971)

  30. Wood, D.: The normal form theorem — another proof. Comput. J. 12, 139–147 (1969)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Soisalon-Soininen, E., Ukkonen, E. A method for transforming grammars into LL(k) form. Acta Informatica 12, 339–369 (1979). https://doi.org/10.1007/BF00268320

Download citation

  • Received:

  • Issue Date:

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

Subject Classifications

Navigation