Advertisement

Acta Informatica

, Volume 40, Issue 6–7, pp 459–489 | Cite as

Reducing non-determinism in right nulled GLR parsers

  • Elizabeth Scott
  • Adrian Johnstone
Article

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.

Keywords

Internal Structure Efficient Implementation Parse Table Context Free Grammar Implementation Technique 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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 YorkGoogle Scholar
  2. 2.
    Aycock, J., Horspool, R.N., Janousek, J., Metichar, B. (2001) Even faster generalised LR parsing. Acta Informatica 37(8): 633-651MathSciNetGoogle Scholar
  3. 3.
    Aho, A.V., Johnson, S.C., Ullman, J.D. (1975) Deterministic parsing of ambiguous grammars. Communications of the ACM 18(8)Google Scholar
  4. 4.
    Aho, A.V., Sethi, R., Ullman, J.D. (1986) Compilers: principles techniques and tools. Addison-WesleyGoogle Scholar
  5. 5.
    Cooper, D. (1983) Standard Pascal user reference manual, 1st edn. WW Norton & CoGoogle Scholar
  6. 6.
    Coppersmith, D., Winograd, S. (1990) Matrix multiplication via arithmetic progressions. J. Symbolic Computation 9: 251-280MathSciNetGoogle Scholar
  7. 7.
    DeRemer, F.L. (1969) Practical translators for LR(k) languages. PhD thesis, Massachussetts Institute of TechnologyGoogle Scholar
  8. 8.
    Earley, J. (1970) An efficient context-free parsing algorithm. Communications of the ACM 13(2): 94-102CrossRefGoogle Scholar
  9. 9.
    Johnson, S.C. (1975) Yacc - yet another compiler-compiler. Technical Report 32, AT&T Bell LaboratoriesGoogle Scholar
  10. 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 YorkGoogle Scholar
  11. 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 JerseyGoogle Scholar
  12. 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 YorkGoogle Scholar
  13. 13.
    Knuth, D.E. (1965) On the translation of languages from left to right. Information and control 8(6): 607-639zbMATHGoogle Scholar
  14. 14.
    Lee, L. (2002) Fast context-free grammar parsing requires fast boolean matrix multiplication. J. ACM 49: 1-15CrossRefGoogle Scholar
  15. 15.
    Nozohoor-Farshi, R. (1991) GLR parsing for \(\epsilon\)-grammars. In: Tomita, M. (ed.) Generalized LR parsing, pp. 60-75. Kluwer Academic Publishers, NetherlandsGoogle Scholar
  16. 16.
    Rekers, J.G. (1992) Parser generation for interactive environments. PhD thesis, Universty of AmsterdamGoogle Scholar
  17. 17.
    Rytter, W. (1995) Context-free recognition via shortest paths computation: a version of Valiant’s algorithm. Theoretical Computer Science 143(2): 343-352CrossRefMathSciNetGoogle Scholar
  18. 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 DepartmentGoogle Scholar
  19. 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 DepartmentGoogle Scholar
  20. 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 DepartmentGoogle Scholar
  21. 21.
    Stroustrup, B. (1994) The Design and Evolution of C++. Addison-Wesley Publishing CompanyGoogle Scholar
  22. 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, NetherlandsGoogle Scholar
  23. 23.
    Tomita, M. (1986) Efficient parsing for natural language. Kluwer Academic Publishers, BostonGoogle Scholar
  24. 24.
    Tomita, M. (1991) Generalized LR parsing. Kluwer Academic Publishers, NetherlandsGoogle Scholar
  25. 25.
    Valiant, L. (1975) General context-free recognition in less than cubic time. J. Comput. Syst. Sci. 10: 308-315Google Scholar
  26. 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-368CrossRefGoogle Scholar
  27. 27.
    Visser, E. (1997) Syntax definition for langauge prototyping. PhD thesis, Universty of AmsterdamGoogle Scholar
  28. 28.
    Younger, D.H. (1967) Recognition of context-free languages in time n 3. Inform. Control 10(2): 189-208zbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin/Heidelberg 2004

Authors and Affiliations

  1. 1.Department of Computer ScienceRoyal Holloway, University of LondonEgham, SurreyUK

Personalised recommendations