Acta Informatica

, Volume 44, Issue 6, pp 427–461 | Cite as

BRNGLR: a cubic Tomita-style GLR parsing algorithm

  • Elizabeth Scott
  • Adrian Johnstone
  • Rob Economopoulos
Original article


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.


Intermediate Node Execution Path Input String Input Symbol Grammar Rule 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    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)Google Scholar
  2. 2.
    Aycock J., Nigel Horspool R., Janousek J., Melichar B. (2001). Even faster generalized LR parsing. Acta Informatica 37(8): 633–651 zbMATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    Aho A.V., Sethi R., Ullman J.D. (1986). Compilers: principles, techniques and tools. Addison-Wesley, Reading Google Scholar
  4. 4.
    Breuer P.T., Bowen J.P. (1995). A PREttier Compiler-Compiler: Generating higher-order parsers in C. Softw. Pract. Exp. 25(11): 1263–1297 CrossRefGoogle Scholar
  5. 5.
    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)Google Scholar
  6. 6.
    Coppersmith D. (1997). Rectangular matrix multiplication revisited. J. Complex. 13: 42–49 zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Dodd, C., Maslov, V.: June (2002)Google Scholar
  8. 8.
    Donnelly, C., Stallman, R.: Bison, the YACC compatible parser generator. Version 2.1 manual., September (2005)Google Scholar
  9. 9.
    Earley J. (1970). An efficient context-free parsing algorithm. Commun. ACM 13(2): 94–102 zbMATHCrossRefGoogle Scholar
  10. 10.
    Eggert, P.: (2003)Google Scholar
  11. 10.
    JAVACC home page, 2000.Google Scholar
  12. 12.
    Johnson, M.: The computational complexity of GLR parsing. In: Masaru, T. (ed.) Generalized LR parsing, pp. 35–42. Kluwer, The Netherlands (1991)Google Scholar
  13. 13.
    Johnstone, A.: bool—a boolean function minimiser. Technical Report CSD–TR–93–25, Computer Science Department, Royal Holloway, University of London, London (1993)Google Scholar
  14. 14.
    Johnstone, A., Scott, E.: rdp—an iterator based recursive descent parser generator with tree promotion operators. SIGPLAN notices, 33(9) (1998)Google Scholar
  15. 15.
    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)Google Scholar
  16. 16.
    Johnstone, A., Scott, E.: RHUL compiler group home page. (2006)Google Scholar
  17. 17.
    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)Google Scholar
  18. 18.
    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 CrossRefGoogle Scholar
  19. 19.
    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)Google Scholar
  20. 20.
    Kipps, J.R.: GLR parsing in time O(n 3). In: Masaru, T. (ed.) Generalized LR parsing, pp. 43–59. Kluwer, The Netherlands (1991)Google Scholar
  21. 21.
    Kernighan, B.W., Ritchie, D.M.: The C Programming Language, second edition. Prentice-Hall, Englewood Cliffs (1988)Google Scholar
  22. 22.
    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)Google Scholar
  23. 23.
    Lee L. (2002). Fast context-free grammar parsing requires fast boolean matrix multiplication. J. ACM 49: 1–15 CrossRefMathSciNetGoogle Scholar
  24. 24.
    Lämmel R., Verhoef C. (2001). Semi-automatic Grammar Recovery. Softw. Pract. Exp. 31(15): 1395–1438 zbMATHCrossRefGoogle Scholar
  25. 25.
    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)Google Scholar
  26. 26.
    Nozohoor-Farshi, R.: GLR parsing for ε-grammars. In: Masaru, T. (ed.) Generalized LR Parsing, pp. 60–75. Kluwer, The Netherlands (1991)Google Scholar
  27. 27.
    Parr, T.: ANTLR home page., Last visited: Dec (2004)Google Scholar
  28. 28.
    Rekers, J.G.: Parser generation for interactive environments. PhD thesis, Universty of Amsterdam (1992)Google Scholar
  29. 29.
    Scott E., Johnstone A. (2004). Reducing non-determinism in right nulled GLR parsers. Acta Informatica 40: 459–489 zbMATHCrossRefMathSciNetGoogle Scholar
  30. 30.
    Scott, E., Johnstone, A.: Right nulled GLR parsers. ACM Trans. Program. Lang. Syst. pp. 1–43 (2006)Google Scholar
  31. 31.
    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)Google Scholar
  32. 32.
    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)Google Scholar
  33. 33.
    Valiant L. (1975). General context-free recognition in less than cubic time. J. Comput. Syst. Sci. 10: 308–315 zbMATHMathSciNetGoogle Scholar
  34. 34.
    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 CrossRefGoogle Scholar
  35. 35.
    Visser, E.: Syntax definition for language prototyping. PhD thesis, Universty of Amsterdam (1997)Google Scholar
  36. 36.
    Younger D.H. (1967). Recognition of context-free languages in time n 3. Inform. Control 10(2): 189–208 zbMATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag 2007

Authors and Affiliations

  • Elizabeth Scott
    • 1
  • Adrian Johnstone
    • 1
  • Rob Economopoulos
    • 1
  1. 1.Department of Computer Science, Royal HollowayUniversity of LondonEghamUK

Personalised recommendations