in reply to Re: Re (tilly) 1: Research ideas
in thread Research ideas
Today NFAs can solve all problems that DFAs can solve, but it is possible to by accident write an NFA that will take several years to finish. My suggestion allows you to convert an NFA into an equivalent NFA which backtracks at fewer points. However it remains an NFA, and where an NFA would find a different match than a DFA, it will find the match that an NFA would find, and not the one that a DFA would. (Thereby allowing it to be used in an NFA engine without changing the behaviour.)
Now if the RE is one that you could use a DFA to solve, then you can convert the NFA into an NFA with no backtracking anywhere. However it still retains NFA characteristics. For instance with alternation it will prefer to match the first alternative in the sequence, and won't match the second if that allows a longer overall match.
Unfortunately optimizing the NFA that far may result in a combinatorial explosion from n states to n!, but since the optimization goes in steps, you can just optimize until you hit some threshold, and then stop. (Or you could run, profile, incrementally optimize, wash, rinse, and repeat.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re (tilly) 3: Research ideas
by gryng (Hermit) on Feb 20, 2001 at 05:50 UTC | |
by tilly (Archbishop) on Feb 20, 2001 at 10:12 UTC | |
by gryng (Hermit) on Feb 20, 2001 at 21:14 UTC | |
by tilly (Archbishop) on Feb 20, 2001 at 23:26 UTC | |
by gryng (Hermit) on Feb 21, 2001 at 00:28 UTC | |
| |
by demerphq (Chancellor) on Mar 22, 2002 at 16:37 UTC |