[DGD] Reasonable Tick Counts?
Shentino
shentino at gmail.com
Wed Jul 11 18:20:37 CEST 2007
My guess is that nomatch's inefficiency comes in because to conclude
it doesn't match anything, there must be a character-wise failure to
match any regex.
In your case, the one and only regex would be "a '@', followed by a
'[', followed by any number of characters that aren't a '[', followed
by a ']'.
IIRC, nomatch's inefficiency is proportional to the number of regex
matches that the parser has to fail before allowing a nomatch to
actually match, since it counts as a "none of the above", it has to
try everything.
As this grammar has only one explicit token rule, I surmise that
inefficiencies will be minimal, since there's only a single token to
worry about failing. You might do better, but I'll leave that as an
exercise. For me, IMHO, nomatch makes things very simple. Plus,
having the above regex would allow you to use ANY markup inside those
brackets you like...including sound effects if you're of a fancy to do
things like that.
Personally, I worry about correctness before I worry about
performance, but that's just me.
Implode/explode I just realized can be problematic if one of your
expansions itself contains an expandable element. I/E is only
guaranteed to work if you do your expansions serially. Since you have
a variable token to convert, I/E can't handle it that well.
More information about the DGD
mailing list