Francisco, On Mon, May 6, 2013 at 1:06 PM, Francisco Mota <fmot...@gmail.com> wrote:
> > Changing the input stream would throw off memoization in a Packrat > parser. > > Only some parts of the memoization table would be invalidated by an insert > or a remove. I thought some about it, and I think you could get away with amending the memoization table by the amount of characters inserted or deleted. For a change made at position (p:p+n), only the table entries in which (i:i+len) intersect the previous range would have to be modified. OTOH, just deleting the affected entries would be simpler, and very safe. > Mizushima and others on this list have work showing that memory use in > Packrat parsers can be sublinear with the addition of cuts, and that cut > insertion can be automated. > > I don't think this would work if one wants to optimize incremental > parsing, as opposed to one-time parsing. You could still introduce manual cuts in the rules in which you know there will be no rewriting. Grako's memory use over 100's of KLOC of COBOL went down to 40%, with no impact on performance, just by boldly deleting entries upon a cut. Cheers, -- JA -- Juancarlo *Añez*
_______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg