On Tue, Mar 18, 2003 at 09:28:43PM -0700, Luke Palmer wrote:
Plan 1:  Pass each rule a I<success> continuation (rather than a
backtrack one), and have it just return on failure.  The big
difference between this and your example is that C<let>s are now
implemented just like C<temp>s.  Too bad C<let> needs non-regex
behavior, too.

That's mechanism #2, not #1


You probably don't mean the word "continuation" here though, since a continuation never returns, so once a rule would invoke the success "continuation" it can't regain control except via another continuation

You probably simply mean a closure


Plan 2:  Call subrules as plain old subs and have them throw a
backtrack exception on failure (or just return a failure-reporting
value... same difference, more or less).

But.. say you have:


<foo> <bar>

Would would this be implemented? When bar fails, it needs to backtrack into foo, which has already returned. Are you saying every rule will be an explicit state machine?


This has the advantage that C<let> behaves consistently with the rest of Perl

What do you mean?



I looked around in Parrot a little, and it seems like continuations
are done pretty efficiently.

Yes, I noticed that do


--
Matthijs van Duin  --  May the Forth be with you!

Reply via email to