Combinator Parsing: A Short Tutorial

There are numerous ways to implement a parser for a given syntax; using parser combinators is a powerful approach to parsing which derives much of its power and expressiveness from the type system and semantics of the host programming language. This tutorial begins with the construction of a small library of parsing combinators. This library introduces the basics of combinator parsing and, more generally, demonstrates how domain specific embedded languages are able to leverage the facilities of the host language. After having constructed our small combinator library, we investigate some shortcomings of the naive implementation introduced in the first part, and incrementally develop an implementation without these problems. Finally we discuss some further extensions of the presented library and compare our approach with similar libraries.

[1]  S. Doaitse Swierstra,et al.  Deterministic, Error-Correcting Combinator Parsers , 1996, Advanced Functional Programming.

[2]  Graham Hutton,et al.  Monadic parsing in Haskell , 1998, Journal of Functional Programming.

[3]  Jurriaan Hage,et al.  Scripting the type inference process , 2003, ICFP '03.

[4]  Philip Wadler XQuery: A Typed Functional Language for Querying XML , 2002, Advanced Functional Programming.

[5]  S. Doaitse Swierstra,et al.  Parsing permutation phrases , 2004, J. Funct. Program..

[6]  Malcolm Wallace Partial Parsing: Combining Choice with Commitment , 2007, IFL.

[7]  Conor McBride,et al.  Applicative programming with effects , 2008, J. Funct. Program..

[8]  Jeroen D. Fokker,et al.  Functional Parsers , 1995, Advanced Functional Programming.

[9]  Philip Wadler,et al.  Packrat parsing:: simple, powerful, lazy, linear time, functional pearl , 2002, ICFP '02.

[10]  Niklas Röjemo Garbage Collection, and Memory Efficiency, in Lazy Functional Languages , 1995 .

[11]  Daan Leijen,et al.  Parsec, a fast combinator parser , 2001 .

[12]  S. Doaitse Swierstra,et al.  Haskell, do you read me?: constructing and composing efficient top-down parsers at runtime , 2008, Haskell '08.

[13]  Koen Claessen Parallel Parsing Processes , 2004, J. Funct. Program..

[14]  Michael J. Fischer,et al.  The String-to-String Correction Problem , 1974, JACM.

[15]  Bastiaan Heeren,et al.  Top quality type error Messages , 2005 .

[16]  Otto C. Juelich,et al.  On the recursive programming techniques , 1964, CACM.

[17]  John Hughes,et al.  Generalising monads to arrows , 2000, Sci. Comput. Program..

[18]  João Saraiva,et al.  Designing and Implementing Combinator Languages , 1998, Advanced Functional Programming.