I want to chime in and mention that Rats! has had a runtime interface for 
pruning memorization tables for quite a while. The C parser uses this interface 
to throw away the table after each external declaration. For real-world C code 
that makes all the difference between running out of memory and keeping it 
manageable. But I would agree that moving that operation into the grammar and 
ensuring its correctness automatically certainly is a good thing.

Robert

On Mar 29, 2013, at 3:36 PM, Juancarlo Añez <apal...@gmail.com> wrote:

> After, the recent experiments, I reviewed the implementation of cut in Grako.
> 
> Grako's implementation of cut is in the spirit of Prolog, which means that a 
> cut applies only to the nearest choice (optional, closure) in the runtime 
> stack. That means that memos for positions before that of the last choice 
> have a non-zero theoretical probability of being reused.
> 
> The explanation for the low impact of my optimistic memo pruning on 
> performance should be that the grammar is for a structured, largely 
> unambiguous, and quite probably LL(k) programming language, which makes it 
> unlikely that previous memos are reused after any structured construct ("IF" 
> cut) has been entered.
> 
> Cheers,
> 
> -- 
> Juancarlo Añez
> _______________________________________________
> PEG mailing list
> PEG@lists.csail.mit.edu
> https://lists.csail.mit.edu/mailman/listinfo/peg

_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to