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.
Similar content being viewed by others
References
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
Aycock, J., Horspool, R.N., Janousek, J., Metichar, B. (2001) Even faster generalised LR parsing. Acta Informatica 37(8): 633-651
Aho, A.V., Johnson, S.C., Ullman, J.D. (1975) Deterministic parsing of ambiguous grammars. Communications of the ACM 18(8)
Aho, A.V., Sethi, R., Ullman, J.D. (1986) Compilers: principles techniques and tools. Addison-Wesley
Cooper, D. (1983) Standard Pascal user reference manual, 1st edn. WW Norton & Co
Coppersmith, D., Winograd, S. (1990) Matrix multiplication via arithmetic progressions. J. Symbolic Computation 9: 251-280
DeRemer, F.L. (1969) Practical translators for LR(k) languages. PhD thesis, Massachussetts Institute of Technology
Earley, J. (1970) An efficient context-free parsing algorithm. Communications of the ACM 13(2): 94-102
Johnson, S.C. (1975) Yacc - yet another compiler-compiler. Technical Report 32, AT&T Bell Laboratories
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
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
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
Knuth, D.E. (1965) On the translation of languages from left to right. Information and control 8(6): 607-639
Lee, L. (2002) Fast context-free grammar parsing requires fast boolean matrix multiplication. J. ACM 49: 1-15
Nozohoor-Farshi, R. (1991) GLR parsing for \(\epsilon\)-grammars. In: Tomita, M. (ed.) Generalized LR parsing, pp. 60-75. Kluwer Academic Publishers, Netherlands
Rekers, J.G. (1992) Parser generation for interactive environments. PhD thesis, Universty of Amsterdam
Rytter, W. (1995) Context-free recognition via shortest paths computation: a version of Valiant’s algorithm. Theoretical Computer Science 143(2): 343-352
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
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
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
Stroustrup, B. (1994) The Design and Evolution of C++. Addison-Wesley Publishing Company
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
Tomita, M. (1986) Efficient parsing for natural language. Kluwer Academic Publishers, Boston
Tomita, M. (1991) Generalized LR parsing. Kluwer Academic Publishers, Netherlands
Valiant, L. (1975) General context-free recognition in less than cubic time. J. Comput. Syst. Sci. 10: 308-315
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
Visser, E. (1997) Syntax definition for langauge prototyping. PhD thesis, Universty of Amsterdam
Younger, D.H. (1967) Recognition of context-free languages in time n 3. Inform. Control 10(2): 189-208
Author information
Authors and Affiliations
Corresponding author
Additional information
Received: 5 December 2002, Published online: 30 March 2004
Rights 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
Issue Date:
DOI: https://doi.org/10.1007/s00236-004-0137-z