## Monadic Parser Combinators (1996)

### Cached

### Download Links

- [www.cs.nott.ac.uk]
- [ftp.cs.nott.ac.uk]
- [uebb.cs.tu-berlin.de]
- [www.cs.nott.ac.uk]
- [www.cs.nott.ac.uk]
- [cs.fit.edu]
- [www.cs.fit.edu]
- [www.cs.nott.ac.uk]
- CiteULike

### Other Repositories/Bibliography

Citations: | 57 - 2 self |

### BibTeX

@MISC{Hutton96monadicparser,

author = {Graham Hutton and Erik Meijer},

title = {Monadic Parser Combinators},

year = {1996}

}

### Years of Citing Articles

### OpenURL

### Abstract

In functional programming, a popular approach to building recursive descent parsers is to model parsers as functions, and to define higher-order functions (or combinators) that implement grammar constructions such as sequencing, choice, and repetition. Such parsers form an instance of a monad, an algebraic structure from mathematics that has proved useful for addressing a number of computational problems. The purpose of this article is to provide a step-by-step tutorial on the monadic approach to building functional parsers, and to explain some of the benefits that result from exploiting monads. No prior knowledge of parser combinators or of monads is assumed. Indeed, this article can also be viewed as a first introduction to the use of monads in programming.

### Citations

458 | Comprehending Monads
- Wadler
- 1990
(Show Context)
Citation Context ...nsen, 1993) and Happy (Gill & Marlow, 1995) that one has the full power of a functional language available to define new combinators for special applications (Landin, 1966). It was realised early on (=-=Wadler, 1990-=-) that parsers form an instance of a monad , an algebraic structure from mathematics that has proved useful for addressing a number of computational problems (Moggi, 1989; Wadler, 1990; Wadler, 1992a;... |

284 | Compilers : principles, techniques and tools - Aho, Sethi, et al. - 1986 |

179 |
The next 700 programming languages
- Landin
- 1966
(Show Context)
Citation Context ... parser generators such as Ratatosk (Mogensen, 1993) and Happy (Gill & Marlow, 1995) that one has the full power of a functional language available to define new combinators for special applications (=-=Landin, 1966-=-). It was realised early on (Wadler, 1990) that parsers form an instance of a monad , an algebraic structure from mathematics that has proved useful for addressing a number of computational problems (... |

178 | A system of constructor classes: overloading and implicit higher-order polymorphism
- Jones
- 1993
(Show Context)
Citation Context ... a new approach to implementing the offside rule, inspired by the use of monads. Some prior exposure to functional programming would be helpful in reading this article, but special features of Gofer (=-=Jones, 1995-=-b) --- our implementation language --- are explained as they are used. Any other lazy functional language that supports (multi-parameter) constructor classes and the use of monad comprehension notatio... |

106 |
Recursive Programming Techniques
- Burge
- 1975
(Show Context)
Citation Context ...der functions (or combinators) that implement grammar constructions such as sequencing, choice, and repetition. The basic idea dates back to at least Burge's book on recursive programming techniques (=-=Burge, 1975-=-), and has been popularised in functional programming by Wadler (1985), Hutton (1992), Fokker (1995), and others. Combinators provide a quick and easy method of building functional parsers. Moreover, ... |

98 | Higher-order functions for parsing
- Hutton
- 1992
(Show Context)
Citation Context ...rom this article is available from the authors, via the World-Wide-Web. 4 Graham Hutton and Erik Meijer 2 Combinator parsers We begin by reviewing the basic ideas of combinator parsing (Wadler, 1985; =-=Hutton, 1992-=-; Fokker, 1995). In particular, we define a type for parsers, three primitive parsers, and two primitive combinators for building larger parsers. 2.1 The type of parsers Let us start by thinking of a ... |

23 | Garbage collection and memory efficiency in lazy functional languages - RÃ¶jemo - 1995 |

19 |
Why Functional Programming Matters", The Computer Journal
- Hughes
- 1989
(Show Context)
Citation Context ...s, many is not as lazy as we would expect. But does this really matter? Yes, because it is common in functional programming to rely on lazyness to avoid the creation of large intermediate structures (=-=Hughes, 1989-=-). As noted by Wadler (1985; 1992b), what is needed to solve the problem with many is a means to make explicit that the parser many p always succeeds. (Even if p itself always fails, many p will still... |

9 |
Ratatosk -- a parser generator and scanner generator for Gofer. Published on comp.lang.functional
- Mogensen
- 1993
(Show Context)
Citation Context ...992), Fokker (1995), and others. Combinators provide a quick and easy method of building functional parsers. Moreover, the method has the advantage over functional parser generators such as Ratatosk (=-=Mogensen, 1993-=-) and Happy (Gill & Marlow, 1995) that one has the full power of a functional language available to define new combinators for special applications (Landin, 1966). It was realised early on (Wadler, 19... |

7 |
A functional theory of exceptions. Science of computer programming
- Spivey
- 1990
(Show Context)
Citation Context ...hat returns the first computation if it succeeds, and the second otherwise. Since failure can be viewed as a simple kind of exception, Maybe is sometimes called the exception monad in the literature (=-=Spivey, 1990-=-). 7.2 The non-determinism monad A natural generalisation of Maybe is the list type constructor []. While a value of type Maybe a can be thought of as a computation that either succeeds with a single ... |

5 | Happy: the parser generator for Haskell - Gill, Marlow - 1995 |

5 |
Functional parsers. Lecture notes of the Baastad Spring school on functional programming
- Fokker
- 1995
(Show Context)
Citation Context ...le is available from the authors, via the World-Wide-Web.s4 Graham Hutton and Erik Meijer 2 Combinator parsers We begin by reviewing the basic ideas of combinator parsing (Wadler, 1985; Hutton, 1992; =-=Fokker, 1995-=-). In particular, we define a type for parsers, three primitive parsers, and two primitive combinators for building larger parsers. 2.1 The type of parsers Let us start by thinking of a parser as a fu... |

3 |
How to replace failure by a list of successes. Proc. conference on functional programming and computer architecture
- Wadler
- 1985
(Show Context)
Citation Context ...nators taken from this article is available from the authors, via the World-Wide-Web. 4 Graham Hutton and Erik Meijer 2 Combinator parsers We begin by reviewing the basic ideas of combinator parsing (=-=Wadler, 1985-=-; Hutton, 1992; Fokker, 1995). In particular, we define a type for parsers, three primitive parsers, and two primitive combinators for building larger parsers. 2.1 The type of parsers Let us start by ... |

3 |
The essence of functional programming. Proc. principles of programming languages
- Wadler
- 1992
(Show Context)
Citation Context ... (Wadler, 1990) that parsers form an instance of a monad , an algebraic structure from mathematics that has proved useful for addressing a number of computational problems (Moggi, 1989; Wadler, 1990; =-=Wadler, 1992-=-a; Wadler, 1992b). As well as being interesting from a mathematical point of view, recognising the monadic nature of parsers also brings practical benefits. For example, using a monadic sequencing com... |

2 | Gofer 2.30a release notes. Unpublished manuscript - Hutton, Jones, et al. - 1994 |

2 |
Functional programming beyond the Hindley/Milner type system. Proc. lecture notes of the Baastad spring school on functional programming
- Jones
- 1995
(Show Context)
Citation Context ... a new approach to implementing the offside rule, inspired by the use of monads. Some prior exposure to functional programming would be helpful in reading this article, but special features of Gofer (=-=Jones, 1995-=-b) --- our implementation language --- are explained as they are used. Any other lazy functional language that supports (multi-parameter) constructor classes and the use of monad comprehension notatio... |

2 |
The Gofer distribution. Available from the University of Nottingham: http://www.cs.nott.ac.uk/Department/Staff/mpj
- Jones
- 1995
(Show Context)
Citation Context ... a new approach to implementing the offside rule, inspired by the use of monads. Some prior exposure to functional programming would be helpful in reading this article, but special features of Gofer (=-=Jones, 1995-=-b) --- our implementation language --- are explained as they are used. Any other lazy functional language that supports (multi-parameter) constructor classes and the use of monad comprehension notatio... |

2 |
Computation lambda-calculus and monads. Proc. IEEE symposium on logic in computer science. A extended version of the paper is available as a technical report from the
- Moggi
- 1989
(Show Context)
Citation Context ...). It was realised early on (Wadler, 1990) that parsers form an instance of a monad , an algebraic structure from mathematics that has proved useful for addressing a number of computational problems (=-=Moggi, 1989-=-; Wadler, 1990; Wadler, 1992a; Wadler, 1992b). As well as being interesting from a mathematical point of view, recognising the monadic nature of parsers also brings practical benefits. For example, us... |

1 |
Functional parsers. Proc. lecture notes of the Baastad Spring school on functional programming
- Fokker
- 1995
(Show Context)
Citation Context ...le is available from the authors, via the World-Wide-Web. 4 Graham Hutton and Erik Meijer 2 Combinator parsers We begin by reviewing the basic ideas of combinator parsing (Wadler, 1985; Hutton, 1992; =-=Fokker, 1995-=-). In particular, we define a type for parsers, three primitive parsers, and two primitive combinators for building larger parsers. 2.1 The type of parsers Let us start by thinking of a parser as a fu... |