Modelling GLL Parser Implementations

  • Adrian Johnstone
  • Elizabeth Scott
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6563)


We describe the development of space-efficient implementations of GLL parsers, and the process by which we refine a set-theoretic model of the algorithm into a practical parser generator that creates practical parsers. GLL parsers are recursive descent-like, in that the structure of the parser’s code closely mirrors the grammar rules, and so grammars (and their parsers) may be debugged by tracing the running parser in a debugger. While GLL recognisers are straightforward to describe, full GLL parsers present technical traps and challenges for the unwary. In particular, naïve implementations based closely on the theoretical description of GLL can result in data structures that are not practical for grammars for real programming language grammars such as ANSI-C. We develop an equivalent formulation of the algorithm as a high-level set-theoretic model supported by table-based indices, in order to then explore a set of alternative implementations which trade space for time in ways which preserve the cubic bound.


GLL parsing general context-free parsing implementation spaces time-space tradeoffs 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Gnu Bison home page (2003),
  2. 2.
    Earley, J.: An efficient context-free parsing algorithm. Communications of the ACM 13(2), 94–102 (1970)CrossRefMATHGoogle Scholar
  3. 3.
    Knuth, D.E.: On the translation of languages from left to right. Information and Control 8(6), 607–639 (1965)MathSciNetCrossRefMATHGoogle Scholar
  4. 4.
    Nozohoor-Farshi, R.: GLR parsing for ε-grammars. In: Tomita, M. (ed.) Generalized LR Parsing, pp. 60–75. Kluwer Academic Publishers, The Netherlands (1991)Google Scholar
  5. 5.
    Scott, E., Johnstone, A.: Generalised bottom up parsers with reduced stack activity. The Computer Journal 48(5), 565–587 (2005)CrossRefGoogle Scholar
  6. 6.
    Scott, E., Johnstone, A.: GLL parsing. Electronic Notes in Theoretical Computer Science (2009)Google Scholar
  7. 7.
    Scott, E., Johnstone, A., Economopoulos, G.: A cubic Tomita style GLR parsing algorithm. Acta Informatica 44, 427–461 (2007)MathSciNetCrossRefMATHGoogle Scholar
  8. 8.
    Tomita, M.: Efficient parsing for natural language. Kluwer Academic Publishers, Boston (1986)CrossRefGoogle Scholar
  9. 9.
    van den Brand, M.G.J., Heering, J., Klint, P., Olivier, P.A.: Compiling language definitions: the ASF+SDF compiler. ACM Transactions on Programming Languages and Systems 24(4), 334–368 (2002)CrossRefGoogle Scholar
  10. 10.
    Younger, D.H.: Recognition of context-free languages in time n 3. Inform. Control 10(2), 189–208 (1967)CrossRefMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Adrian Johnstone
    • 1
  • Elizabeth Scott
    • 1
  1. 1.Royal HollowayUniversity of LondonEghamUK

Personalised recommendations