At 10:05 AM +0100 3/19/03, Matthijs van Duin wrote:
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?

By compile-time interpolation. <foo> isn't so much a subroutine as a macro. For this to work, if we had:


  foo: \w+?
  bar: [plugh]{2,5}

then what the regex engine *really* got to compile would be:

(\w+?) ([plugh]{2,5})

with names attached to the two paren groups. Treating them as actual subroutines leads to madness, continuations don't quite work, and coroutines could pull it off if we could pass data back into a coroutine on reinvocation, but...

We do, after all, want this fast, right?
--
                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to