Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers > Re: Leftmost lo...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 8 Topic 2416 of 2529
Post > Topic >>

Re: Leftmost longest match with DFA search

by Danny.Dube@[EMAIL PROTECTED] (=?iso-8859-1?q?Danny_Dub May 15, 2008 at 11:58 AM

Stefan Monnier <monnier@[EMAIL PROTECTED]
> writes:

[snip]
> >> The "obvious" solution of turning the problem "search for RE" into
the
> >> problem "match .*RE" (where I use "match" here to mean "anchored
> >> search") only gives you the leftmost shortest match.
> > [snip]
> >> Stefan
>
> > I've used the approach to compile a DFA for the reverse RE, say ER,
and
> > first match .*ER on the reverse text to find the leftmost anchor
point.
> >   Then match RE from that point to find the longest span.
>
> Interesting.  But doesn't it basically force you to scan the complete
text?
> That can be impractical.

You don't (always) need to scan the complete text.  You can perform
that reversed search on increasingly longer prefixes of the text.  If
you increase the lengths of the prefixes by a constant factor, you
work for a time in O(K) to find a leftmost match when the latter
completely lies in the first K characters.

Danny
 




 8 Posts in Topic:
Leftmost longest match with DFA search
Stefan Monnier <monnie  2008-05-10 04:36:57 
Re: Leftmost longest match with DFA search
Daniel Villeneuve <dan  2008-05-11 11:42:22 
Re: Leftmost longest match with DFA search
Stefan Monnier <monnie  2008-05-13 04:51:39 
Re: Leftmost longest match with DFA search
Danny.Dube@[EMAIL PROTECT  2008-05-15 11:58:45 
Re: Leftmost longest match with DFA search
"Russ Cox" <  2008-05-12 08:09:04 
Re: Leftmost longest match with DFA search
Stefan Monnier <monnie  2008-05-13 05:02:56 
Re: Leftmost longest match with DFA search
Danny.Dube@[EMAIL PROTECT  2008-05-13 13:58:56 
Re: Leftmost longest match with DFA search
"Russ Cox" <  2008-05-14 16:30:00 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 14:35:25 CDT 2008.