On Thu, Mar 17, 2011 at 10:58 PM, Niklas Broberg
<niklas.brob...@gmail.com>wrote:

> > >  I already export a partial parser for top-of-file pragmas,
> >
> > I see. What I don't see is how such a parser would return the "rest of
> input".
>
> Hmm. I see. And I see that you are correct in not seeing it, since it
> appears it cannot be done with Happy, which I believed. It would then be
> down to the parser/lexer to pass on unconsumed input, which seems a daunting
> and disruptive task, seeing how the lexer typically would tokenize some
> input in advance before the parser discovers that it cannot consume what has
> been lexed... Hmm.
>

I think this is actually doable, although not necessarily easy, using a
technique due to Oleg. He has used delimited continuations to take ordinary
parsers and make them incremental. Dan Doel has experimented with applying
the technique to Parsec parsers with some success. I think choosing the
right parser monad in Happy can make this work.

Reference to Oleg's technique:
http://okmij.org/ftp/continuations/differentiating-parsers.html

Cheers,

Josef
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to