Abstract
In the compiler literature, parsing algorithms for context-free grammars are presented using string rewriting systems or abstract machines such as pushdown automata. Unfortunately, the resulting descriptions can be baroque, and even a basic understanding of some parsing algorithms, such as Earley’s algorithm for general context-free grammars, can be elusive. In this paper, we present a graphical representation of context-free grammars called the Grammar Flow Graph (GFG) that permits parsing problems to be phrased as path problems in graphs; intuitively, the GFG plays the same role for context-free grammars that nondeterministic finite-state automata play for regular grammars. We show that the GFG permits an elementary treatment of Earley’s algorithm that is much easier to understand than previous descriptions of this algorithm. In addition, look-ahead computation can be expressed as a simple inter-procedural dataflow analysis problem, providing an unexpected link between front-end and back-end technologies in compilers. These results suggest that the GFG can be a new foundation for the study of context-free grammars.
Chapter PDF
Similar content being viewed by others
Keywords
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.
References
Reynolds, J.C.: On the relation between direct and continuation semantics. In: Loeckx, I.J. (ed.) ICALP 1974. LNCS, vol. 14, pp. 141–156. Springer, Heidelberg (1974)
Sussman, G., Steele, G.: Scheme: An interpreter for extended lambda calculus. Technical Report AI Memo 349, AI Lab, M.I.T. (December 1975)
Earley, J.: An efficient context-free parsing algorithm. Commun. ACM 13(2), 94–102 (1970)
Aho, A., Lam, M., Sethi, R., Ullman, J.: Compilers: principles, techniques, and tools. Addison Wesley (2007)
Grune, D., Jacobs, C.: Parsing Techniques: A practical guide. Springer (2010)
Cousot, P., Cousot, R.: Parsing as abstract interpretation of grammar semantics. Theoret. Comput. Sci. 290, 531–544 (2003)
Woods, W.A.: Transition network grammars for natural language analysis. Commun. ACM 13(10) (October 1970)
Parr, T., Fisher, K.: LL(*): The foundation of the ANTLR parser generator. In: PLDI (2011)
Yannakakis, M.: Graph-theoretic methods in database theory. In: Principles of Database Systems (1990)
Sippu, S., Soisalon-Soininen, E.: Parsing theory. Springer (1988)
Sharir, M., Pnueli, A.: Two approaches to interprocedural dataflow analysis. In: Program Flow Analysis: Theory and Applications, pp. 189–234. Prentice-Hall (1981)
Cormen, T., Leiserson, C., Rivest, R., Stein, C. (eds.): Introduction to Algorithms. MIT Press (2001)
Hopcroft, J.E., Motwani, R., Ullman, J.D.: Introduction to Automata Theory, Languages, and Computation, 3rd edn. Addison-Wesley Longman Publishing Co., Inc., Boston (2006)
Clinger, W.D., Halpern, C.: Alternative semantics for mccarthy’s amb. In: Brookes, S.D., Roscoe, A.W., Winskel, G. (eds.) Seminar on Concurrency. LNCS, vol. 197, pp. 467–478. Springer, Heidelberg (1985)
Terese: Term Rewriting Systems. Combridge University Press (2003)
Graham, S.L., Ruzzo, W.L., Harrison, M.: An improved context-free recognizer. ACM TOPLAS 2(3), 415–462 (1980)
Aycock, J., Horspool, N.: Practical Earley parsing. The Computer Journal 45(6), 620–630 (2002)
Perlin, M.: LR recursive transition networks for Earley and Tomita parsing. In: ACL 1991 (1991)
Pereira, F.C.N., Warren, D.: Parsing as deduction. In: 21st Annual Meeting of the Association for Computational Linguistics, pp. 137–144. MIT, Cambridge (1983)
Shieber, S.M., Schabes, Y., Pereira, F.C.N.: Principles and implementation of deductive parsing. Journal of Logic Programming 24(1 & 2), 3–36 (1995)
Sikkel, K.: Parsing Schemata. Texts in Theoretical Computer Science. Springer, Heidelberg (1997)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2015 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Pingali, K., Bilardi, G. (2015). A Graphical Model for Context-Free Grammar Parsing. In: Franke, B. (eds) Compiler Construction. CC 2015. Lecture Notes in Computer Science(), vol 9031. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-46663-6_1
Download citation
DOI: https://doi.org/10.1007/978-3-662-46663-6_1
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-662-46662-9
Online ISBN: 978-3-662-46663-6
eBook Packages: Computer ScienceComputer Science (R0)