Functional Pearl: Parsing Permutation Phrases

Functional Pearl: Parsing Permutation Phrases

Arthur Baars, Andres Löh, S. Doaitse Swierstra.


Abstract:

A permutation phrase is a sequence of elements (possibly of different types) in which each element occurs exactly once and the order is irrelevant. Some of the permutable elements may be optional. We show a way to extend a parser combinator library with support for parsing such free-order constructs. A user of the library can easily write parsers for permutation phrases and does not need to care about checking and reordering the recognised elements. Possible applications include the generation of parsers for attributes of \XML tags and Haskell's record syntax.


Available as 145K gzipped postscript or 175K PDF.