On Sat, Jun 6, 2015 at 12:11 PM, Keean Schupke <ke...@fry-it.com> wrote:
What I do in the C++ combinators, because backtracking is controlled by the > 'attempt' parser (its the only place backtracking happens) is save the > current state and restore it on backtracking. The current state is threaded > like the inherited attributes of an attribute grammar, so if you want > backtracking it has to be copyable and assignable. > So the "copyable and assignable" part makes sense, but I don't know that this answers the question I was trying to ask. Assume the parse result is some form of graph structure. Perhaps an AST. How do we get unreachable subtrees collected? It's a problem for LR parsers as well. I'm just curious what your mental model is for how to do that. Offhand, I think refcounted pointers. Backtracking seems to be one of those things that's harder to do without GC. shap
_______________________________________________ bitc-dev mailing list bitc-dev@coyotos.org http://www.coyotos.org/mailman/listinfo/bitc-dev