[Haskell-cafe] Lazy parser with parsec.

David Brown haskell2 at davidb.org
Mon Mar 26 12:15:16 EDT 2007


I'm trying to figure out how to write a simple parser in Parsec to
tokenize a subset of RTF.

The problem is that I haven't been able to come up with a way of
writing the parser that doesn't try consuming all of the input just
to return the first token.

The 'many' primitive's implementation uses an accumulator, and
obviously has to parse to the end.  Trying to iterate myself causes
stack overflows on large inputs.

Does anyone know of any existing Parser parsers that don't consume
their entire input, or am I probably best off making my own parser.

Thanks,
David



More information about the Haskell-Cafe mailing list