comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: GNAT.Regpat problem.
Date: Thu, 24 Mar 2011 15:34:28 +0100
Date: 2011-03-24T15:34:32+01:00	[thread overview]
Message-ID: <5exbsdc3coio.1ke3vi3sk7ss4.dlg@40tude.net> (raw)
In-Reply-To: alpine.WNT.2.00.1103241003330.4896@WHIRLWIND

On Thu, 24 Mar 2011 10:04:43 -0400, Peter C. Chapin wrote:

> On Thu, 24 Mar 2011, Dmitry A. Kazakov wrote:
> 
>> Just curious, why are you using regular expressions when GNAT offers 
>> Spitbol patterns?
> 
> Spitbol patterns seemed like overkill.

In that case I would suggest wildcard patterns.

> Are you saying that there is no valid 
> use case for the regular expression packages in GNAT's library (aside, 
> perhaps, for legacy support)?

IMO regular expressions as a class of languages is far too weak for things
more complex than trivial, but utterly unnatural for issues like matching
*.adb. The syntax of RE is just horrific.

So, yes, it is difficult to find a case where RE could find place. And in
general, any patterns are unusable for syntax analyzers for many reasons, I
don't want to go into. A manually written scanner is simpler and safer.

For user-defined filters (e.g. for file search etc), lists of wild-card
patterns or some reduced form of BNF is IMO the best choice. The reason why
is that the user should instantly recognize what get matched and what does
not. Any patterns more complex than brain-dead wildcards fail here.

BTW,  there recently was an article criticizing overuse of REs in UNIX,
suggesting SNOBOL-like patterns instead. I don't remember where. Though it
does not tell anything one would not know 25 years ago.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2011-03-24 14:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-22 18:35 GNAT.Regpat problem Peter C. Chapin
2011-03-22 19:01 ` Georg Bauhaus
2011-03-22 19:17 ` Florian Weimer
2011-03-22 19:21 ` Adam Beneschan
2011-03-22 20:31   ` Simon Wright
2011-03-24 10:23     ` Peter C. Chapin
2011-03-24 10:43       ` Dmitry A. Kazakov
2011-03-24 14:04         ` Peter C. Chapin
2011-03-24 14:34           ` Dmitry A. Kazakov [this message]
2011-03-24 16:20             ` Georg Bauhaus
2011-03-24 17:37               ` Dmitry A. Kazakov
2011-03-24 21:12             ` Peter C. Chapin
2011-03-25  9:02               ` Dmitry A. Kazakov
2011-03-24 16:41           ` Georg Bauhaus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox