Abstract
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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Gnu Bison home page (2003), http://www.gnu.org/software/bison
Earley, J.: An efficient context-free parsing algorithm. Communications of the ACM 13(2), 94–102 (1970)
Knuth, D.E.: On the translation of languages from left to right. Information and Control 8(6), 607–639 (1965)
Nozohoor-Farshi, R.: GLR parsing for ε-grammars. In: Tomita, M. (ed.) Generalized LR Parsing, pp. 60–75. Kluwer Academic Publishers, The Netherlands (1991)
Scott, E., Johnstone, A.: Generalised bottom up parsers with reduced stack activity. The Computer Journal 48(5), 565–587 (2005)
Scott, E., Johnstone, A.: GLL parsing. Electronic Notes in Theoretical Computer Science (2009)
Scott, E., Johnstone, A., Economopoulos, G.: A cubic Tomita style GLR parsing algorithm. Acta Informatica 44, 427–461 (2007)
Tomita, M.: Efficient parsing for natural language. Kluwer Academic Publishers, Boston (1986)
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)
Younger, D.H.: Recognition of context-free languages in time n 3. Inform. Control 10(2), 189–208 (1967)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2011 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Johnstone, A., Scott, E. (2011). Modelling GLL Parser Implementations. In: Malloy, B., Staab, S., van den Brand, M. (eds) Software Language Engineering. SLE 2010. Lecture Notes in Computer Science, vol 6563. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-19440-5_4
Download citation
DOI: https://doi.org/10.1007/978-3-642-19440-5_4
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-19439-9
Online ISBN: 978-3-642-19440-5
eBook Packages: Computer ScienceComputer Science (R0)