develooper Front page | perl.perl6.language.regex | Postings from January 2001

Re: Exposing regexp engine & compiled regexp's

Thread Previous | Thread Next
Jarkko Hietaniemi
January 8, 2001 15:02
Re: Exposing regexp engine & compiled regexp's
Message ID:
On Tue, Jan 09, 2001 at 09:53:10AM +1100, Damian Conway wrote:
>    > I once brutalized Henry Spencer's engine into telling me when I was
>    > on my way to a match.  This was for a UI: I wanted to be able to say
>    > that the input should only match this RE, and if they typed something
>    > that broke the match, I could beep and disallow the character.
>    > 
>    > I was just a greenhorn then, so it coredumped.  But it's another use
>    > for access to internal engine states and failure reasons.
> Good point. Perhaps, on failure, a regex could set $@ to indicate what the
> problem was:
> 	while (gui_getchar($nextchar)) {
> 		$input.$nextchar =~ m/$pattern/;
> 		if ($@ =~ /fail/) { beep }
> 		else              { $input .= $nextchar }
> 	}

Another related idea that has been circling in my brain lately is that
do we really need to have separate compilation and execution steps in
our regex engine?  Wouldn't an incremental on-demand engine be much
more flexible and optimizable (e.g. finding 'the fast path' smells
like input-driven LRU to me)?  (Also much worse hell to implement,
but let's worry about that later :-)

$jhi++; #
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About