Paul Eggert wrote:
> I doubt whether implementing regex optimizations along these 
> lines would interest anybody other than automata theorists.

But for simpler optimizations, I think the regcomp() function
should implement optimizations that are dependent on the
internal algorithm used by regexec().

Just like a decent C compiler does constant propagation and
common subexpression elimination, a regex compiler should
transform

    \(abc\|abra\) -> ab\(c\|ra\)
    .*..*..* -> ...*
    \(ace\|brace\) -> \(\|br\)ace     (or vice versa?)

and similar things. Especially the last one, where it's
not clear to a user like me which of the two forms is the
more efficient one to execute.

Bruno




Reply via email to