
Very interesting, thanx. I haven't finished grokking this yet, but... Basically, this one is of the "somehow return errors inline" category. The errors are returned inline, together with the expression that computes the result, so that you can extract either the errors and/or the result whenever convenient. I'd be worried about the performance you can get from this breadth-first approach. I sort of like the fine-tuning control that the "try" approach gives in parsec. I'll finish the paper before giving this any more thought, though. JCAB Jeremy Shaw wrote:
At Wed, 17 May 2006 11:36:00 -0700, Juan Carlos Arevalo Baeza wrote:
Is there any known alternative that doesn't exhibit this behavior? It would have to somehow return errors inline or on a "side channel". I'll be toying with this sort of thing for a while.
You might try reading,
Polish Parsers, Step By Step by R. John M. Hughes and S. Doaise Swierstra
http://www.cs.uu.nl/docs/vakken/afp/Literature/p224-swierstra.pdf
From the abstract: --- We present the derivation of a space efficient parser combin- ator library: the constructed parsers do not keep unneces- sary references to the input, produce online results and effi- ciently handle ambiguous grammars. The underlying tech- niques can be applied in many contexts where traditionally backtracking is used. ---
By 'online' they mean able to starting producing results before the whole thing is parsed.
j. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe