Author:
HUTTON GRAHAM,MEIJER ERIK
Abstract
This paper is a tutorial on defining recursive descent parsers
in Haskell. In the spirit
of one-stop shopping, the paper combines material from three areas
into a single
source. The three areas are functional parsers (Burge, 1975; Wadler, 1985;
Hutton,
1992; Fokker, 1995), the use of monads to structure functional programs
(Wadler,
1990, 1992a, 1992b), and the use of special syntax for monadic programs
in Haskell
(Jones, 1995; Peterson et al., 1996). More specifically, the paper
shows how to define
monadic parsers using do notation in Haskell.Of course, recursive descent parsers defined by hand lack the efficiency
of bottom-up
parsers generated by machine (Aho et al., 1986; Mogensen, 1993;
Gill and
Marlow, 1995). However, for many research applications, a simple recursive
descent
parser is perfectly sufficient. Moreover, while parser generators typically
offer a
fixed set of combinators for describing grammars, the method described
here is
completely extensible: parsers are first-class values, and we have the
full power of
Haskell available to define new combinators for special applications. The
method is
also an excellent illustration of the elegance of functional programming.
Publisher
Cambridge University Press (CUP)
Cited by
95 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. A Language and Its Compiler for Programming Serverless Applications;2024 47th MIPRO ICT and Electronics Convention (MIPRO);2024-05-20
2. Algebraic Effects Meet Hoare Logic in Cubical Agda;Proceedings of the ACM on Programming Languages;2024-01-05
3. The Naproche-ZF Theorem Prover (Short Paper);Lecture Notes in Computer Science;2024
4. byteparsing: a functional parser combinator for mixed
ASCII/binary data;Journal of Open Source Software;2023-04-25
5. Fluent APIs in Functional Languages;Proceedings of the ACM on Programming Languages;2023-04-06