On Tue, Jan 27, 2015 at 3:42 PM, Andreas Kupries <[email protected]> wrote:
> I guess that in this scheme the lexemes marked as :discard are always > active/acceptable so that we can skip them wherever they occur. > between actual G1 lexemes "Acceptable/unacceptable" is defined in terms of G1, and the discard tokens are not visible to G1. So "acceptable" is not a well-defined concept for discard tokens. The practical effect is, yes, that they are always treated as "active". > How complex would it be for the internals of a recognizer to release > the parse table and other allocated things to get back into an initial > state ? It would be sort of a 'destroy', then 'create', except that > the main structure would not be thrown away and re-allocated, but > re-used instead. The gain of a full recognizer reset over throw-away-and-recreate might be very small -- in fact, negative. That's because Libmarpa memory management is heavily optimized -- all Earley sets, items, etc., etc. go into a single data structure (an "obstack"). When I destroy the recognizer, I do *not* have to retrace all the links and dependencies in the Earley tables -- I just throw away the obstack. So full destruction is blazingly fast. A reset scheme would require retracing or garbage collection, perhaps recopying, etc., etc. It might well be slower. > Your way of fully recreating the object after every X lexemes might be > the best we can do. Given the kind of memory management I just described, the recreate-every-X-lexemes method might in fact be optimal. -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
