skip to main content
article

A new top-down parsing algorithm to accommodate ambiguity and left recursion in polynomial time

Published:01 May 2006Publication History
Skip Abstract Section

Abstract

Top-down backtracking language processors are highly modular, can handle ambiguity, and are easy to implement with clear and maintainable code. However, a widely-held, and incorrect, view is that top-down processors are inherently exponential for ambiguous grammars and cannot accommodate left-recursive productions. It has been known for many years that exponential complexity can be avoided by memoization, and that left-recursive productions can be accommodated through a variety of techniques. However, until now, memoization and techniques for handling left recursion have either been presented independently, or else attempts at their integration have compromised modularity and clarity of the code.

References

  1. Camarao, C., Figueiredo, L. and Oliveira, R. H. (2003) Mimico: A Monadic Combinator Compiler Generator. Journal of the Brazilian Computer Society Vol 9(1).]]Google ScholarGoogle ScholarCross RefCross Ref
  2. Frost, R. A. and Hafiz, R. (2006) Using monads to accommodate ambiguity and left recursion with parser combinators. Technical Report 06-007 School of Computer Science, University of Windsor, Canada.]]Google ScholarGoogle Scholar
  3. Frost, R. A. (2003) Monadic memoization --- Towards Correctness-Preserving Reduction of Search. AI 2003 eds. Y. Xiang and B. Chaib-draa. LNAI 2671 66--80.]]Google ScholarGoogle Scholar
  4. Frost, R. A. (1993) Guarded attribute grammars. Software Practice and Experience. 23 (10) 1139--1156.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Hutton, G. (1992) Higher-order functions for parsing. J. Functional Programming 2 (3) 323--343.]]Google ScholarGoogle ScholarCross RefCross Ref
  6. Johnson, M. (1995) Squibs and Discussions: Memoization in top-down parsing. Computational Linguistics 21 (3) 405--417.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Koopman, P. and Plasmeijer, R. (1999) Efficient combinator parsers. In Implementation of Functional Languages, LNCS, 1595:122 138. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Koskimies, K. (1990) Lazy recursive descent parsing for modular language implementation. Software Practice and Experience, 20 (8) 749--772.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Kuno, S. (1965) The predictive analyzer and a path elimination technique. Communications of the ACM 8(7) 453--462.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Leermakers, R. (1993) The Functional Treatment of Parsing. Kluwer Academic Publishers, ISBN 0-7923-9376-7.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Lickman, P. (1995) Parsing With Fixed Points. Master's Thesis, University of Cambridge.]]Google ScholarGoogle Scholar
  12. Nederhof, M. J. and Koster, C. H. A. (1993) Top-Down Parsing for Left-recursive Grammars. Technical Report 93-10 Research Institute for Declarative Systems, Department of Informatics, Faculty of Mathematics and Informatics, Katholieke Universiteit, Nijmegen.]]Google ScholarGoogle Scholar
  13. Norvig, P. (1991) Techniques for automatic memoisation with applications to context-free parsing. Computational Linguistics 17 (1) 91--98.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Shiel, B. A. 1976 Observations on context-free parsing. Technical Report TR 12-76, Center for Research in Computing Technology, Aiken Computational Laboratory, Harvard University.]]Google ScholarGoogle Scholar
  15. Tomita, M. (1985) Efficient Parsing for Natural Language. Kluwer, Boston, MA.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Wadler, P. (1985) How to replace failure by a list of successes, in P. Jouannaud (ed.) Functional Programming Languages and Computer Architectures Lecture Notes in Computer Science 201, Springer-Verlag, Heidelberg, 113.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A new top-down parsing algorithm to accommodate ambiguity and left recursion in polynomial time

            Recommendations

            Comments

            Login options

            Check if you have access through your login credentials or your institution to get full access on this article.

            Sign in

            Full Access

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader