Deterministic, error-correcting combinator parsers
We show how error-correcting, deterministic, combinator parsers can be constructed for grammars which have the LL(1) property. The normal disadvantages of conventional combinator parsers, such as their lack of speed and their poor error reporting, are remedied. Parsers constructed with these combinators are implicitly specialised for the grammar they describe. Because of this property the combinators act as a parser generator for LL(1) grammars. The techniques used to construct the combinators illustrate how partial parametrisation and careful ordering of computations can be used to achieve implicit partial evaluation in a lazy language.
KeywordsInput Sequence Error Message Error Recovery Input Symbol Binary Search Tree
Unable to display preview. Download preview PDF.
- 1.Jeroen Fokker. Functional parsers. In Johan Jeuring and Erik Meijer, editors, Advanced functional programming, Baastad Summerschool Tutorial Text, volume 925 of LNCS, pages 1–23. Springer, 1995.Google Scholar
- 2.Graham Hutton. Higher-order functions for parsing. Journal of functional programming, 2:323–343, 1992.Google Scholar
- 3.Mark, P. Jones A System of Constructor Classes: Overloading and Implicit Higher-Order Polymorphism Conference on Functional Programming Languages and Computer Architecture, Copenhagen, Denmark, pages 52–64, ACM, 1993.Google Scholar
- 4.Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial Evaluation and Automatic Program generation. Prentice-Hall, 1993.Google Scholar
- 5.Andrew Partridge and David Wright. Parser combinators need four values to report errors. Technical report, Department of Computer Science, Tasmania, 1994.Google Scholar
- 6.M. Pennings, S.D. Swierstra, and H.H. Vogt. Using cached functions and constructors for incremental attribute evaluation. In M. Bruynooghe and M. Wirsing, editors, Programming Language Implementation and Logic Programming, volume 631 of LNCS, pages 130–144. Springer, 1992.Google Scholar
- 7.Maarten Pennings. Generating Incremental Attribute Evaluators. PhD thesis, Utrecht University, Dept. of Computer Science, 1994. www.cs.ruu.nl.Google Scholar
- 8.Niklas Röjemo. Garbage collection, and memory efficiency, in lazy functional languages. PhD thesis, Chalmers, firstname.lastname@example.org, 1995.Google Scholar
- 9.Philip Wadler. Monads for functional programming. In Johan Jeuring and Erik Meijer, editors, Advanced functional programming, Baastad Summerschool Tutorial Text, volume 925 of LNCS, pages 24–52. Springer, 1995.Google Scholar