[Haskell-cafe] Parsing in Practice

Nils Anders Danielsson nad at cs.chalmers.se
Tue Oct 18 12:21:34 EDT 2005

On Tue, 18 Oct 2005, Philippa Cowderoy <flippa at flippac.org> wrote:

> If you've got a decent chunk of test data or don't mind generating
> it with QuickCheck odds are you can spot it reasonably quickly when
> it happens.

When I write a parser I usually also write a pretty-printer (or
ugly-printer) plus the following property:

  prop_parsePretty x = parse (pretty x) == x

Randomly generating abstract syntax trees using QuickCheck is often

I can't remember ever having found a bug in code that has passed this
kind of test. (But I guess that I haven't written parsers for very
complicated languages...)


More information about the Haskell-Cafe mailing list