Related articles |
---|
RE's in sets qjackson@direct.ca (1996-06-23) |
From: | qjackson@direct.ca |
Newsgroups: | comp.compilers |
Date: | 23 Jun 1996 23:19:16 -0400 |
Organization: | Parsepolis Software ("ParseCity") |
Keywords: | lex |
I've a simple question that nonetheless begs an answer....
I have a Set container class that can have as members:
a) String terminals,
b) RE-like patterns,
c) pointers to C++ calls that match or fail to
match a substring (functionally similar to [b])
Consider the following set:
S = { "foo", [a-z]+s }
In a Set, another submission of "foo" is clearly rejected, as would
be another entry of the RE [a-z]+s, but what would be the case if
the following were submitted for entry:
cats
Should the RE match against "cats" and therefore veto the entry of
the new member, or should the Set now read:
S = { "foo", [a-z]+s, "cats" }
Literal terminals naturally are more speedy to match later, but RE
members that veto entries that match them are more compact. I might
set a boolean flag for the class to allow either behavior, but I am
wondering if anyone here has had experience with both models, in case
I'm missing some proof that predicts dangerous side-effects.
Another, intermediate idea that I've had is to set some level flag so
that efficient matches, such as "cats" would not be explicitly added,
whereas expensive matches, such as "internationalists" would be added
explicitly.
Cheers,
Quinn
--
Quinn Tyler Jackson, E.A.C. --> qjackson@direct.ca
Rael MacKenzie
[Seems to me with heterogeneous sets like this, you can make up any rules you
want. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.