On Wed, Mar 19, 2003 at 10:40:02AM -0500, Dan Sugalski wrote:
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,

Ehm, Foo.test cannot inline Foo.foo since it may be overridden:


grammar Foo {
        rule foo { \w+? }
        rule bar { [plugh]{2,5} }
        rule test { <foo> <bar> }
}

grammar Bar is Foo {
        rule foo { <alpha>+? }
}

What you say is only allowed if I put "is inline" on foo.



continuations don't quite work

Care to elaborate on that? I'd say they work fine


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

Ofcourse, and we should optimize as much as we can - but not optimize *more* than we can. Rules need generic backtracking semantics, and that's what I'm talking about. Optimizations to avoid the genericity of these backtracking semantics is for later.


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

Reply via email to