[REBOL] Re: Parse versus Regular Expressions
From: greggirwin:mindspring at: 5-Apr-2003 18:15
Hi Joel et al,
Sorry I don't have time to think deeply (or dink theeply) about this
right now, but it's great topic.
<< Well, since there is no "pure RE" language, I have to use RE as
embedded in *some* programming language. I could have just as well
used Python, Ruby, Java, awk, etc... >>
Are you sure about AWK? I didn't think it supported backreferences,
and a quick check in the Friedl RE book seems to bear that out (though
a couple modern AWK's might).
OK so taking AWK out isn't that important, or why I'm writing. What
seems important to me is that - as you pointed out - RE needs a host
language and there are many flavors of RE out there. The biggest
differences will be between the NFA and DFA engines (DFA engines not
supporting backtracking AFAIK).
Now, I'm going to be in way over my head if I continue down this path,
but it strikes me that we can probably look at the differences in that
context rather than on a case-by-case basis with examples. I.e. come
up with a general solution, or model, about how to design PARSE rules
for these kinds of grammars/situations. This thread has already provided
some good examples.
For those with the time and desire, the dragon book has a section on
how to construct a DFA from an NFA which might provide some pointers.
-- Gregg