|[2 earlier articles]|
|Re: Regular expressions speedup email@example.com (Cleo Saulnier) (2005-08-07)|
|Re: Regular expressions speedup firstname.lastname@example.org (2005-08-10)|
|Re: Regular expressions speedup email@example.com (Paolo Bonzini) (2005-08-10)|
|Re: Regular expressions speedup firstname.lastname@example.org (Tony Finch) (2005-08-10)|
|Re: Regular expressions speedup email@example.com (2005-08-10)|
|Re: Regular expressions speedup firstname.lastname@example.org (2005-08-10)|
|Re: Regular expressions speedup email@example.com (2005-08-13)|
|Re: Regular expressions speedup firstname.lastname@example.org (Cleo Saulnier) (2005-08-13)|
|Date:||13 Aug 2005 00:24:50 -0400|
|Organization:||Department of Computer Science, University of Copenhagen|
|References:||05-08-023 05-08-028 05-08-036|
|Posted-Date:||13 Aug 2005 00:24:50 EDT|
email@example.com (Hans Aberg) writes:
> John Levine <firstname.lastname@example.org> wrote:
> > > The book by Aho, Sethi & Ullman, "Compilers...", end of sec. 3.7, says
> > > that best for both space and time is a "lazy transition evaluation"
> > > technique.
> > [I wonder if they feel differently about space tradeoffs now than they
> > did 30 years ago. At that point, programs had to fit into 16 bit address
> > spaces. -John]
> A NFA to DFA translation may, in bad cases, result in an exponential
> expansion, in which case no computer will suffice, no matter how much
> memory it has. So in order to avoid that, one might use the suggestion
> above. That is, translating the NFA to DFA transitions at need, caching
> the partial DFA. The quote above also says that this lazy technique may be
> faster than a full runtime NFA to DFA translation, in view of that unused
> DFA transitions need not be computed.
At one point I ran into a regular expression that generated an
enourmous DFA. My solution was to rewrite it into a context-free
grammar and then use an LR parser to generate a parser table. While
these tables can also be exponential, it worked in this case because
the parse stack can remember things that would otherwise have to be
remembered in the DFA. Translating regular expressions to grammar
rules is quite simple.
Return to the
Search the comp.compilers archives again.