[Haskell-cafe] Wanted: composoable parsers from haskell-src-exts
S. Doaitse Swierstra
doaitse at swierstra.net
Fri Mar 18 21:45:28 CET 2011
Although this may need a bit of work you might take the parsing code form the Utrecht Haskell Compiler (http://www.cs.uu.nl/wiki/bin/view/UHC/Download), which uses the uulib parser combinators. They are top-down parsers, and thus can be used to parse any prefix given a specific parser, i.e. given the non-terminal which describes the prefix.
The UHC contains a separate scanner, since the layout rule makes scannerless parsing very complicated.
The uulib should be easily replaced with the newer uu-parsing lib, but this may again a bit of some work. This latter library is more easily adapted, and has less complicated internals.
On 14 mrt 2011, at 18:55, J. Waldmann wrote:
> I want to use parsers from haskell-src-exts as sub-parsers,
> which does not seem to work since they insist on consuming the input completely.
> I would need them to parse a maximal prefix,
> and return the (unconsumed) rest of input as well
> I figure that happy has the %partial directive for that, but the description
> does not really tell me how to obtain the rest of the input.
> Any hints (or code samples) appreciated. Thanks - J.W.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe