Abstract
Tomita-style generalised LR (GLR) algorithms extend the standard LR algorithm to non-deterministic grammars by performing all possible choices of action. Cubic complexity is achieved if all rules are of length at most two. In this paper we shall show how to achieve cubic time bounds for all grammars by binarising the search performed whilst executing reduce actions in a GLR-style parser. We call the resulting algorithm Binary Right Nulled GLR (BRNGLR) parsing. The binarisation process generates run-time behaviour that is related to that shown by a parser which pre-processes its grammar or parse table into a binary form, but without the increase in table size and with a reduced run-time space overhead. BRNGLR parsers have worst-case cubic run time on all grammars, linear behaviour on LR(1) grammars and produce, in worst-case cubic time, a cubic size binary SPPF representation of all the derivations of a given sentence.
Similar content being viewed by others
References
Aycock, J., Horspool, N.: Faster generalised LR parsing. In: Compiler Construction, 8th International Conference, CC’99, vol. 1575 of Lecture Notes in Computer Science, pp. 32–46. Springer, Heidelberg (1999)
Aycock J., Nigel Horspool R., Janousek J., Melichar B. (2001). Even faster generalized LR parsing. Acta Informatica 37(8): 633–651
Aho A.V., Sethi R., Ullman J.D. (1986). Compilers: principles, techniques and tools. Addison-Wesley, Reading
Breuer P.T., Bowen J.P. (1995). A PREttier Compiler-Compiler: Generating higher-order parsers in C. Softw. Pract. Exp. 25(11): 1263–1297
Billot, S., Lang, B.: The structure of shared forests in ambiguous parsing. In: Proceedings of the 27th conference on Association for Computational Linguistics, pp. 143–151. Association for Computational Linguistics (1989)
Coppersmith D. (1997). Rectangular matrix multiplication revisited. J. Complex. 13: 42–49
Dodd, C., Maslov, V.: http://www.siber.com/btyacc. June (2002)
Donnelly, C., Stallman, R.: Bison, the YACC compatible parser generator. Version 2.1 manual., September (2005)
Earley J. (1970). An efficient context-free parsing algorithm. Commun. ACM 13(2): 94–102
Eggert, P.: http://compilers.iecc.com/comparch/article/03-01-042 (2003)
JAVACC home page http://www.metamata.com/JavaCC, 2000.
Johnson, M.: The computational complexity of GLR parsing. In: Masaru, T. (ed.) Generalized LR parsing, pp. 35–42. Kluwer, The Netherlands (1991)
Johnstone, A.: bool—a boolean function minimiser. Technical Report CSD–TR–93–25, Computer Science Department, Royal Holloway, University of London, London (1993)
Johnstone, A., Scott, E.: rdp—an iterator based recursive descent parser generator with tree promotion operators. SIGPLAN notices, 33(9) (1998)
Johnstone, A., Scott, E.: Generalised regular parsers. In: Gorel, H. (ed.) Compiler Construction, 12th International Conference CC’03, vol. 2622 of Lecture Notes in Computer Science, pp. 232–246. Springer, Berlin (2003)
Johnstone, A., Scott, E.: RHUL compiler group home page. http://www.cs.rhul.ac.uk/research/languages/ (2006)
Johnstone, A., Scott, E., Economopoulos, G.: Generalised parsing: some costs. In: Evelyn, D. (ed.) Compiler Construction, 13th International Conference CC’04, vol. 2985 of Lecture Notes in Computer Science, pp. 89–103. Springer, Berlin (2004)
Johnstone A., Scott E., Economopoulos G. (2004). The grammar tool box: a case study comparing GLR parsing algorithms. Electron. Notes Theoret. Comput. Sci. 110: 97–133
Johnstone, A., Scott, E., Economopoulos, G.: The GTB and PAT tools. In: Gorel, H., Eric Van, W. (eds.) Proceedings of the 4th Workshop on Language Descriptions, Tools and Applications LDTA2004. INRIA (2004)
Kipps, J.R.: GLR parsing in time O(n 3). In: Masaru, T. (ed.) Generalized LR parsing, pp. 43–59. Kluwer, The Netherlands (1991)
Kernighan, B.W., Ritchie, D.M.: The C Programming Language, second edition. Prentice-Hall, Englewood Cliffs (1988)
Lang, B.: Deterministic techniques for efficient non-deterministic parsers. In: Automata, Lanugages and Programming: 2nd Colloquium, vol. 14 of Lecture Notes in Computer Science, pp. 255–269. Springer, Heidelberg (1974)
Lee L. (2002). Fast context-free grammar parsing requires fast boolean matrix multiplication. J. ACM 49: 1–15
Lämmel R., Verhoef C. (2001). Semi-automatic Grammar Recovery. Softw. Pract. Exp. 31(15): 1395–1438
McPeak, S., Necula, G.: Elkhound: a fast, practical GLR parser generator. In: Evelyn, D. (ed.) Compiler Construction, 13th International Conference CC’04, Lecture Notes in Computer Science. Springer, Berlin (2004)
Nozohoor-Farshi, R.: GLR parsing for ε-grammars. In: Masaru, T. (ed.) Generalized LR Parsing, pp. 60–75. Kluwer, The Netherlands (1991)
Parr, T.: ANTLR home page. http://www.antlr.org, Last visited: Dec (2004)
Rekers, J.G.: Parser generation for interactive environments. PhD thesis, Universty of Amsterdam (1992)
Scott E., Johnstone A. (2004). Reducing non-determinism in right nulled GLR parsers. Acta Informatica 40: 459–489
Scott, E., Johnstone, A.: Right nulled GLR parsers. ACM Trans. Program. Lang. Syst. pp. 1–43 (2006)
Scott, E.A., Johnstone, A.I.C., Economopoulos, G.R.: BRN-table based GLR parsers. Technical Report TR-03-06, Computer Science Department, Royal Holloway, University of London, London (2003)
Scott, E., Johnstone, A., Hussain, S.S.: Tomita-style generalised LR parsers. Updated Version. Technical Report TR-00-12, Computer Science Department, Royal Holloway, University of London, London, December (2000)
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 Trans. Program. Lang. Syst. 24(4): 334–368
Visser, E.: Syntax definition for language prototyping. PhD thesis, Universty of Amsterdam (1997)
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
Rights and permissions
About this article
Cite this article
Scott, E., Johnstone, A. & Economopoulos, R. BRNGLR: a cubic Tomita-style GLR parsing algorithm. Acta Informatica 44, 427–461 (2007). https://doi.org/10.1007/s00236-007-0054-z
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00236-007-0054-z