Re: Regex niceties for the parser (was Re: To get things started...)
[email protected] ("Rocco Caputo") Mon, 27 Nov 2000 13:29:27 -0500 (EST)
| Newsgroups | perl.perl6.internals.api.parser |
|---|---|
| Message-ID | <[email protected]> |
Text::Trie is an amazing little module. I've abused it in a macro processing source filter to build optimum regexps out of lists of tokens. I've attached a proof-of-concept/benchmark program using the interesting bits from POE::Preprocessor to build, test, and time regexps. Results of a sample run are included after __END__. -- Rocco Caputo / [email protected] / poe.perl.org On Mon, 27 Nov 2000 12:37:52 -0500, Dan Sugalski wrote: >At 05:17 PM 11/27/00 +0000, Nicholas Clark wrote: >> > >>>>> "ST" == Sam Tregar <[email protected]> writes: >> > ST> Perhaps we really need a new kind of regex that works by-design against >> > ST> streams of bytes? >> >>I don't think any change is needed in the regex syntax. I think just being >>careful to use minimal matching whenever possible should be sufficient. > >What we could use, though, is a way to specify weighted alternatives in >regexes, so we could have a single regex look for multiple things at once >and match the one we'd prefer if there are alternatives. I don't even >really care if we can't do it inside a regex specification itself and need >to do odd things with regex objects. > >Yeah, I know we can do this with alternations and such, but that can get >really messy when we're pasting a half-zillion regexes together. > > Dan
rop.perl
(application/octet-stream, 5.6 KB) - not displayed