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.
- 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 ScholarCross Ref
- 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 Scholar
- 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 Scholar
- Frost, R. A. (1993) Guarded attribute grammars. Software Practice and Experience. 23 (10) 1139--1156.]] Google ScholarDigital Library
- Hutton, G. (1992) Higher-order functions for parsing. J. Functional Programming 2 (3) 323--343.]]Google ScholarCross Ref
- Johnson, M. (1995) Squibs and Discussions: Memoization in top-down parsing. Computational Linguistics 21 (3) 405--417.]] Google ScholarDigital Library
- Koopman, P. and Plasmeijer, R. (1999) Efficient combinator parsers. In Implementation of Functional Languages, LNCS, 1595:122 138. Springer-Verlag.]] Google ScholarDigital Library
- Koskimies, K. (1990) Lazy recursive descent parsing for modular language implementation. Software Practice and Experience, 20 (8) 749--772.]] Google ScholarDigital Library
- Kuno, S. (1965) The predictive analyzer and a path elimination technique. Communications of the ACM 8(7) 453--462.]] Google ScholarDigital Library
- Leermakers, R. (1993) The Functional Treatment of Parsing. Kluwer Academic Publishers, ISBN 0-7923-9376-7.]] Google ScholarDigital Library
- Lickman, P. (1995) Parsing With Fixed Points. Master's Thesis, University of Cambridge.]]Google Scholar
- 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 Scholar
- Norvig, P. (1991) Techniques for automatic memoisation with applications to context-free parsing. Computational Linguistics 17 (1) 91--98.]] Google ScholarDigital Library
- 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 Scholar
- Tomita, M. (1985) Efficient Parsing for Natural Language. Kluwer, Boston, MA.]] Google ScholarDigital Library
- 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 ScholarDigital Library
Index Terms
- A new top-down parsing algorithm to accommodate ambiguity and left recursion in polynomial time
Recommendations
Packrat parsing:: simple, powerful, lazy, linear time, functional pearl
ICFP '02: Proceedings of the seventh ACM SIGPLAN international conference on Functional programmingPackrat parsing is a novel technique for implementing parsers in a lazy functional programming language. A packrat parser provides the power and flexibility of top-down parsing with backtracking and unlimited lookahead, but nevertheless guarantees ...
Packrat parsing:: simple, powerful, lazy, linear time, functional pearl
Packrat parsing is a novel technique for implementing parsers in a lazy functional programming language. A packrat parser provides the power and flexibility of top-down parsing with backtracking and unlimited lookahead, but nevertheless guarantees ...
Left recursion in Parsing Expression Grammars
Parsing Expression Grammars (PEGs) are a formalism that can describe all deterministic context-free languages through a set of rules that specify a top-down parser for some language. PEGs are easy to use, and there are efficient implementations of PEG ...
Comments