> My main questions are:
> 
>  Is there a simpler system I'm overlooking?
>  Which of the two systems would you prefer if speed isn't the issue?

Mechanism 1.

>  Which system is likely to run faster on parrot?

They're both likely to be very slow.

> and maybe also:
>  What is the current plan?
>
> although I got the impression earlier that there isn't any yet for invoking 
> subrules :-)

Sure there is.  It's boling away in my brain and in my local parrot
copy.  (You haven't seen any commits because I'm overhauling it and it
doesn't... well... work yet).

My plan is to allow whatever we find is best, and swap them around
and benchmark them seperately.  But the two engines I have in mind
include one very similar to your two examples, and one more classical
approach.

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.

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).  This has the advantage that
C<let> behaves consistently with the rest of Perl.  It has the
disadvantage that we have to manually implement backtracking through
individual rules.  It has the advantage that it's easier to optimize.

I looked around in Parrot a little, and it seems like continuations
are done pretty efficiently.  So, I can't really say which of these
would be faster, but I'd guess the latter.

I'll be writing them both, though, so we'll see :)

Luke

Reply via email to