Improved GLR Parsing Algorithm

  • Miao Li
  • ZhiGuo Wei
  • Jian Zhang
  • ZeLin Hu
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3645)

Abstract

Tomita devised a method of generalized LR(GLR) parsing to parse ambiguous grammars efficiently. A GLR parser uses linear-time LR parsing techniques as long as possible, falling back on more expensive general techniques when necessary. In this paper, the motivation of adopting the GLR parsing algorithm to construct parsers for programming languages is presented. We create a multi-level scheme to fasten the GLR parser. We introduce runtime control mechanisms to the GLR parser to invoke semantic actions attached to grammar rules. The algorithm has been implemented in Development Expert Tools (DET), a compiler which is designed by Institute of Intelligent Machines, Chinese Academy of Sciences, at Hefei. Experiments show that the speed of our GLR parser is comparable to LALR(1) parsers when parsing deterministic programming languages.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Tomita, M.: An Efficient Augumented-Contxt-Free Parsing Algorithm. Computational Lingustics 13, 31–46 (1987)Google Scholar
  2. 2.
    Gao, Z.Y., Jin, M.Z.: The Theory and Construction of Compilers, pp. 100–127. Beijing University of Aeronautics and Astronautics Press, Beijing (1990)Google Scholar
  3. 3.
    Billot, S., Lang, B.: The structure of shared forest in ambiguous parsing. In: Proc. of the 6th Int’l Computational Ligustics (ACL 1989), pp. 143–151 (1989)Google Scholar
  4. 4.
    Parr, T.J.: Obtaining practical variants of LL(K) and LR(k) for k>1 by splitting the atomic k-tuple (Ph.D.Thesis). West Lafayette, Purdue University (1993)Google Scholar
  5. 5.
    McPeak, S., Elkhound, N.G.: A GLR parser generator. In: Proc. of the 13th Int’l Conf. on Complier Construction, pp. 51–56. Springer, Heidelberg (2004)Google Scholar
  6. 6.
    Tomita, M.: Generalized LR Parsing. Kluwer Academic Publishers, Dordrecht (1991)MATHGoogle Scholar
  7. 7.
    McPeak, S., Elkhoud, N.G.: A GLR parser generator. In: Proc. of the 13th Int’l Conf. on Compiler Construction, pp. 51–56. Springer, Heidelberg (2004)Google Scholar
  8. 8.
    Bhamidipaty, A., Proebsting, T.A.: Very Fast YACC-Compatiable Parsers(For Very Little Effort). Technical Report TR 95-09, Department of Computer Science, University of Arizona (1995)Google Scholar
  9. 9.
    Eades, P., Lin, X., Smyth, W.F.: A fast and effective heuristic for the feedback arc set problem. Information Processing Letters 47, 319–323 (1993)MATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Kipps, J.R.: GLR parsing in Time O(n2). In: Tomita, pp. 43–59 (1984)Google Scholar
  11. 11.
    Knuth, D.E.: On the Translation of Languages from Left to Right. Information and Control 8, 607–693 (1965)CrossRefMathSciNetGoogle Scholar
  12. 12.
    Kruseman Aretz, F.E.J.: On a Recursive Ascent Parser. Information Processing Letters 29, 201–206 (1998)CrossRefGoogle Scholar
  13. 13.
    Leermakers, R.: Recursive ascent parsing: From Early to Marcus. Theoretical Computer Science 104, 299–312 (1992)MATHCrossRefMathSciNetGoogle Scholar
  14. 14.
    Aho, A.V., Scthi, R., Ullman, J.D.: Compiler:Principals, Techniques, and Tools. Addison-Wesley, Reading (1986)Google Scholar
  15. 15.
    Weng, F.L., Zhou, B., Wu, L.D.: Process the phenomena of extra grammaticality in NL parsing. Journal of Chinese Information Processing 8, 1–13 (1994)Google Scholar
  16. 16.
    Parr, T.J., Quong, R.W.: ANTLR: A predicated-LL(k) parser generator. Software-Practice and Experience 25, 789–810 (1995)CrossRefGoogle Scholar
  17. 17.
    Aycock, J.: Faster Tomita Parsing. MSc thesis, University of Victoria (1998)Google Scholar
  18. 18.
    Aycock, J., Horspool, N., Janousek, J., Melichar, B.: Even faster generalize parsing. Acta Informatica 37, 633–651 (2001)MATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    Donelly, C., Stallmen, R.: The Bison Manual: Using the YACC-Compatible Parser Generator, for Bison Version 1.875. GUN Press, Boston (2004)Google Scholar
  20. 20.
    Fisher, M., Ellis, J., Bruce, J.: JDBC API Tutorial and Reference, 3rd edn., Sun Microsystem (2004)Google Scholar
  21. 21.
    Flanagan, D.: Java Example in a Nutshell, 2nd edn. O’Reilly & Association, Sebastopol (2003)Google Scholar
  22. 22.
    Armstrong, E., et al.: The Java Web Services Tutorial. Pearson Education (2003)Google Scholar
  23. 23.
    Oaks, S., Wong, H.: Java Threads. O’Reilly & Association, Sebastopol (1999)Google Scholar
  24. 24.
    Tomita, M.: An Effective Parsing for Natural Language. Kluwer Academic Publishers, Dordrecht (1986)Google Scholar
  25. 25.
    Zhou, M., Liu, X., Huang, C.N.: An efficient stochastic context-free parsing algorithm. Journal of Software 9, 59–87 (1998)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • Miao Li
    • 1
  • ZhiGuo Wei
    • 1
  • Jian Zhang
    • 1
  • ZeLin Hu
    • 1
  1. 1.Institute of Intelligent MachinesChinese Academy of SciencesHefei AnhuiP.R.China

Personalised recommendations