Abstract
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.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
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.
Graham Hutton. Higher-order functions for parsing. Journal of functional programming, 2:323–343, 1992.
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.
Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial Evaluation and Automatic Program generation. Prentice-Hall, 1993.
Andrew Partridge and David Wright. Parser combinators need four values to report errors. Technical report, Department of Computer Science, Tasmania, 1994.
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.
Maarten Pennings. Generating Incremental Attribute Evaluators. PhD thesis, Utrecht University, Dept. of Computer Science, 1994. www.cs.ruu.nl.
Niklas Röjemo. Garbage collection, and memory efficiency, in lazy functional languages. PhD thesis, Chalmers, rojemo@cs.chalmers.se, 1995.
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.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1996 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Swierstra, S.D., Duponcheel, L. (1996). Deterministic, error-correcting combinator parsers. In: Launchbury, J., Meijer, E., Sheard, T. (eds) Advanced Functional Programming. AFP 1996. Lecture Notes in Computer Science, vol 1129. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-61628-4_7
Download citation
DOI: https://doi.org/10.1007/3-540-61628-4_7
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-61628-3
Online ISBN: 978-3-540-70639-7
eBook Packages: Springer Book Archive