Does Perl combine multiple REs into a single automaton?
From: Clint Olsen (clint_at_0lsen.net)
Date: 06/28/04
- Next message: Krisztian VASAS: "Problem with Gtk2 and POE"
- Previous message: Martin Adler: "how to NOT quote constants in hash keys"
- Next in thread: Anno Siegel: "Re: Does Perl combine multiple REs into a single automaton?"
- Reply: Anno Siegel: "Re: Does Perl combine multiple REs into a single automaton?"
- Reply: Abigail: "Re: Does Perl combine multiple REs into a single automaton?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 28 Jun 2004 17:04:23 GMT
Hi:
I posted earlier about how to speed up writing lexical analyzers in Perl.
With that effort in mind, I was curious to know if Perl combines multiple
patterns like:
if (/pat/) {
} elsif (/pat1/) {
...
} elsif (/pat2/) {
...
...
...
} else {
}
so that pat[\d]+ are in a sense combined via alternation with each branch
working like embedded action code?
The reason why I ask is that someone suggested I try to do this manually in
order to help speed up the pattern matching process (presumably using the
"(?{ code })" feature documented in perlre. Is it really faster to do it
this way?
When I'm in the debugger in Perl, I've noticed that the execution path gets
sort of muddied. I don't see Perl executing each match as a separate
statement. It's as if it jumps right to the code for the pattern match.
If that's the case, then there's not much of a compelling argument to embed
action code and cobmine REs.
Thanks,
-Clint
- Next message: Krisztian VASAS: "Problem with Gtk2 and POE"
- Previous message: Martin Adler: "how to NOT quote constants in hash keys"
- Next in thread: Anno Siegel: "Re: Does Perl combine multiple REs into a single automaton?"
- Reply: Anno Siegel: "Re: Does Perl combine multiple REs into a single automaton?"
- Reply: Abigail: "Re: Does Perl combine multiple REs into a single automaton?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|