gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] regexps for namespace


From: Tom Lord
Subject: Re: [Gnu-arch-users] regexps for namespace
Date: Mon, 29 Mar 2004 16:28:54 -0800 (PST)

    > From: Jean Helou <address@hidden>

    > I finally found some time to start hacking namespace.(c|h) to
    > make it use regexps.

Please don't.

Operationally, those pattern-matching checks are rather heavily used
and likely to become moreso.   Meanwhile, especially but not
exclusively in light of Unicode, regexps ain't so cheap.   Oh, they
can be fast (at non-trivial cost in space) and they can be flexible
(e.g., matching a pattern only determined at run-time) --- but they
can't hold a candle to a hard-coded lexer.

You should really only have to put one regexp engine in a program and
the constraints such an engine has to satisfy aren't a very good
description of the problem that namespace.[ch] needs to solve.  The
regexp engine I've chosen for arch is a little too heavyweight for
namespace.[ch]

Changes to the namespace functions should be made in the existing
style.  Yes, it's a bit tedious but it's also kina fun, isn't it?
Trying to write these things up by hand without making a big hairy
mess?  The constraint also helps to keep the namespace simple in
structure.

If you _really_ _really_ feel you _must_ use regexps to specify the
namespace, please take the approach of using static compilation of
those regexps.   Fuss around with GNU flex or somesuch.   (But, please
note, there has to be a really good reason for me to make arch depend 
on flex to be compiled.)

    > Next step will convert over_base_name, over_version and over_patch_level 
    > to use regular expressions too.

Stop! Stop!   Go back!   :-)

    > Cheers,

Likewise.

-t







reply via email to

[Prev in Thread] Current Thread [Next in Thread]