[antlr-interest] executing actions during backtrack
Micheal J
open.zone at virgin.net
Wed May 10 04:30:13 PDT 2006
Ter,
> What if we could auto unroll any object/data-structured you
> identified somehow as transactional? You would give me an undo()
> method for each object, like a hashtable. I could record the
> arguments to pass to undo so it knows how to undo. This
> would not be
> perfect as the arguments could point at stuff that could
> change (like
> a stringbuffer), but would be a poor man's transactions.
.....
.....
.....
> undoActions.add(new Action324(scope,$ID.text));
>
> Later we can walk undoActions and undo everything.
>
> Hmm...would this work? Surely in this case. The key is passing all
> necessary data to the undo as evaluated in its original context.
The value of the 'backtracking' attribute already serves as a state flag to
ANTLR users concerned about the interactions of actions and backtracking. I
vote we leave it there.
Stripped down, fast-as-possible, easy to read/debug source code (well easier
to read than LR equivalents) for ANTLR generated language processors remains
the goal right?
Micheal
More information about the antlr-interest
mailing list