Skip to main content
Log in

Reducing non-determinism in right nulled GLR parsers

  • Published:
Acta Informatica Aims and scope Submit manuscript

Abstract.

Tomita’s general parsing algorithm is linear on LR(1) grammars but fails to terminate on grammars with hidden left recursion and is not efficient in the presence of \(\epsilon\)-rules. When Right Nulled (RN) parse tables are used Tomita style GLR algorithms operate correctly and more efficiently on all context free grammars. However, an RN table may contain more conflicts than the corresponding LR table, making the construction of parts of the internal structure redundant. We show that in certain cases conflicts can be removed from an RN table without compromising the correctness of the associated parser. In particular, all conflicts can be removed if the grammar is LR(1). This improves the performance of the parser and allows resolved RN tables for LR(1) grammars to be used with standard (deterministic) LR stack-based parsing algorithms, adding the ‘short-circuiting’ of right nullable reductions to the armoury of efficient implementation techniques for such algorithms.

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.

Institutional subscriptions

Similar content being viewed by others

References

  1. Aycock, J., Horspool, N. (1999) Faster generalised LR parsing. Compiler Construction: 8th International Conference, CC’99, vol. 1575 (Lecture Notes in Computer Science), pp. 32-46. Springer, Berlin Heidelberg New York

    Google Scholar 

  2. Aycock, J., Horspool, R.N., Janousek, J., Metichar, B. (2001) Even faster generalised LR parsing. Acta Informatica 37(8): 633-651

    MathSciNet  Google Scholar 

  3. Aho, A.V., Johnson, S.C., Ullman, J.D. (1975) Deterministic parsing of ambiguous grammars. Communications of the ACM 18(8)

  4. Aho, A.V., Sethi, R., Ullman, J.D. (1986) Compilers: principles techniques and tools. Addison-Wesley

  5. Cooper, D. (1983) Standard Pascal user reference manual, 1st edn. WW Norton & Co

  6. Coppersmith, D., Winograd, S. (1990) Matrix multiplication via arithmetic progressions. J. Symbolic Computation 9: 251-280

    MathSciNet  Google Scholar 

  7. DeRemer, F.L. (1969) Practical translators for LR(k) languages. PhD thesis, Massachussetts Institute of Technology

  8. Earley, J. (1970) An efficient context-free parsing algorithm. Communications of the ACM 13(2): 94-102

    Article  Google Scholar 

  9. Johnson, S.C. (1975) Yacc - yet another compiler-compiler. Technical Report 32, AT&T Bell Laboratories

  10. Johnstone, A., Scott, E. (1998) Generalised recursive descent parsing and follow determinism. In: Koskimies, K. (ed.) Proc. 7th Intnl. Conf. Compiler Construction (CC’98), (Lecture notes in Computer Science 1383), pp. 16-30. Springer, Berlin Heidelberg New York

  11. Johnstone, A., Scott, E. (2002) Generalised reduction modified LR parsing for domain specific language prototyping. Proc. 35th Annual Hawaii International Conference On System Sciences (HICSS02), IEEE Computer Society. IEEE, New Jersey

  12. Johnstone, A., Scott, E. (2003) Generalised regular parsers. Computer Construction, 12th Intnl, Conf. CC2003. (Lecture Notes in Computer Science 2622), pp 232-246. Springer, Berlin Heidelberg New York

  13. Knuth, D.E. (1965) On the translation of languages from left to right. Information and control 8(6): 607-639

    MATH  Google Scholar 

  14. Lee, L. (2002) Fast context-free grammar parsing requires fast boolean matrix multiplication. J. ACM 49: 1-15

    Article  Google Scholar 

  15. Nozohoor-Farshi, R. (1991) GLR parsing for \(\epsilon\)-grammars. In: Tomita, M. (ed.) Generalized LR parsing, pp. 60-75. Kluwer Academic Publishers, Netherlands

  16. Rekers, J.G. (1992) Parser generation for interactive environments. PhD thesis, Universty of Amsterdam

  17. Rytter, W. (1995) Context-free recognition via shortest paths computation: a version of Valiant’s algorithm. Theoretical Computer Science 143(2): 343-352

    Article  MathSciNet  Google Scholar 

  18. Scott, E., Johnstone, A. (2002) Reducing non-determinism in reduction modified LR(1)-parsers. Technical Report TR-02-04, Royal Holloway, University of London, Computer Science Department

  19. Scott, E.A., Johnstone, A.I.C., Economopolous, G.R. (2003) BRN-table based GLR parsers. Technical Report TR-03-06, Royal Holloway, University of London, Computer Science Department

  20. Scott, E., Johnstone, A., Hussain, S.S. (2000) Tomita-style generalised LR parsers. UPDATED VERSION. Technical Report TR-00-12, Royal Holloway, University of London, Computer Science Department

  21. Stroustrup, B. (1994) The Design and Evolution of C++. Addison-Wesley Publishing Company

  22. Tomita, M., Ng, S.-K. (1991) The generalised LR parsing algorithm. In: Tomita, M. (ed.) Generalized LR parsing, pp. 1-16. Kluwer Academic Publishers, Netherlands

  23. Tomita, M. (1986) Efficient parsing for natural language. Kluwer Academic Publishers, Boston

  24. Tomita, M. (1991) Generalized LR parsing. Kluwer Academic Publishers, Netherlands

  25. Valiant, L. (1975) General context-free recognition in less than cubic time. J. Comput. Syst. Sci. 10: 308-315

  26. van den Brand, M.G.J., Heering, J., Klint, P., Olivier, P.A. (2002) Compiling language definitions: the ASF+SDF compiler. ACM Transactions on Programming Languages and Systems 24(4): 334-368

    Article  Google Scholar 

  27. Visser, E. (1997) Syntax definition for langauge prototyping. PhD thesis, Universty of Amsterdam

  28. Younger, D.H. (1967) Recognition of context-free languages in time n 3. Inform. Control 10(2): 189-208

    MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Elizabeth Scott.

Additional information

Received: 5 December 2002, Published online: 30 March 2004

Rights and permissions

Reprints and permissions

About this article

Cite this article

Scott, E., Johnstone, A. Reducing non-determinism in right nulled GLR parsers. Acta Informatica 40, 459–489 (2004). https://doi.org/10.1007/s00236-004-0137-z

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00236-004-0137-z

Keywords

Navigation