Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #385: Dyslexics retyping hosts file on servers


comp / comp.unix.shell / Re: Command Languages Versus Programming Languages

SubjectAuthor
* Re: Command Languages Versus Programming LanguagesBozo User
+* Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
|`* Re: Command Languages Versus Programming Languagesusuario
| `* Re: Command Languages Versus Programming LanguagesMuttley
|  `* Re: Command Languages Versus Programming Languagesusuario
|   `- Re: Command Languages Versus Programming LanguagesMuttley
`* Re: Command Languages Versus Programming LanguagesRainer Weikusat
 `* Re: Command Languages Versus Programming LanguagesMuttley
  +* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |+* Re: Command Languages Versus Programming LanguagesMuttley
  ||+* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |||+* Re: Command Languages Versus Programming LanguagesKaz Kylheku
  ||||`* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |||| `* Re: Command Languages Versus Programming LanguagesBart
  ||||  `* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  ||||   `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    +* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |+* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    ||+* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||`* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    ||| `* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||  `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||   +* Re: Command Languages Versus Programming LanguagesScott Lurndal
  ||||    |||   |`- Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||   `* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||    `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||     +* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     |+* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||     ||+* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     |||`* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||     ||| +* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     ||| |`* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||     ||| | `* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     ||| |  `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||    |||     ||| |   `* Re: Command Languages Versus Programming LanguagesScott Lurndal
  ||||    |||     ||| |    `- Re: Command Languages Versus Programming LanguagesDavid Brown
  ||||    |||     ||| `- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  ||||    |||     ||`- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  ||||    |||     |`* Re: Command Languages Versus Programming LanguagesScott Lurndal
  ||||    |||     | `* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     |  `* Re: Command Languages Versus Programming LanguagesBart
  ||||    |||     |   `* Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |||     |    `* Re: Command Languages Versus Programming LanguagesBart
  ||||    |||     |     `- Re: On overly rigid definitions (was Re: Command Languages Versus Programming LaDan Cross
  ||||    |||     `- Re: Command Languages Versus Programming LanguagesScott Lurndal
  ||||    ||`* Re: Command Languages Versus Programming LanguagesKaz Kylheku
  ||||    || +- Re: Command Languages Versus Programming LanguagesBart
  ||||    || `- Re: Command Languages Versus Programming LanguagesDan Cross
  ||||    |`- Re: Command Languages Versus Programming LanguagesScott Lurndal
  ||||    +* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  ||||    |`- Re: Command Languages Versus Programming LanguagesMuttley
  ||||    `* Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  ||||     `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||      +* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  ||||      |+* Re: Command Languages Versus Programming LanguagesChristian Weisgerber
  ||||      ||+- Re: Command Languages Versus Programming LanguagesMuttley
  ||||      ||`- Re: Command Languages Versus Programming LanguagesRainer Weikusat
  ||||      |`- Re: Command Languages Versus Programming LanguagesBart
  ||||      `* Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  ||||       `* Re: Command Languages Versus Programming LanguagesMuttley
  ||||        `- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  |||+* Re: Command Languages Versus Programming LanguagesBart
  ||||`- Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |||`* Re: Command Languages Versus Programming LanguagesMuttley
  ||| `- Re: Command Languages Versus Programming LanguagesRainer Weikusat
  ||`- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  |`* Re: Command Languages Versus Programming LanguagesEric Pozharski
  | `* Re: Command Languages Versus Programming LanguagesMuttley
  |  +- Re: Command Languages Versus Programming LanguagesJanis Papanagnou
  |  +* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |  |`* Re: Command Languages Versus Programming LanguagesMuttley
  |  | `* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |  |  `* Re: Command Languages Versus Programming LanguagesMuttley
  |  |   `* Re: Command Languages Versus Programming LanguagesRainer Weikusat
  |  |    `- Re: Command Languages Versus Programming LanguagesMuttley
  |  `- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
  `* Re: Command Languages Versus Programming LanguagesSebastian
   +* Re: Command Languages Versus Programming LanguagesMuttley
   |+* Re: Command Languages Versus Programming LanguagesWolfgang Agnes
   ||`- Re: Command Languages Versus Programming LanguagesMuttley
   |+- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
   |`* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
   | `* Re: Command Languages Versus Programming LanguagesMuttley
   |  +* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
   |  |`* Re: Command Languages Versus Programming LanguagesMuttley
   |  | `* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
   |  |  `- Re: Command Languages Versus Programming LanguagesMuttley
   |  `- Re: Command Languages Versus Programming LanguagesWolfgang Agnes
   `* Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
    +* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
    |+- Re: Command Languages Versus Programming LanguagesWolfgang Agnes
    |`- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
    `* Re: Command Languages Versus Programming LanguagesRandal L. Schwartz
     +- Re: Command Languages Versus Programming LanguagesLawrence D'Oliveiro
     `* Re: Command Languages Versus Programming LanguagesMuttley
      +* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
      |+* Re: Command Languages Versus Programming LanguagesMuttley
      ||`* Re: Command Languages Versus Programming LanguagesJanis Papanagnou
      || +* Re: Command Languages Versus Programming LanguagesMuttley
      || |`* Re: Command Languages Versus Programming LanguagesRainer Weikusat
      || | +* Re: Command Languages Versus Programming LanguagesJohn Ames
      || | `* Re: Command Languages Versus Programming LanguagesMuttley
      || `* Re: Command Languages Versus Programming LanguagesRainer Weikusat
      |`* Re: Command Languages Versus Programming LanguagesKaz Kylheku
      +* Re: Command Languages Versus Programming LanguagesEd Morton
      `* Re: Command Languages Versus Programming LanguagesRainer Weikusat

Pages:1234567
Subject: Re: Command Languages Versus Programming Languages
From: Lawrence D'Oliv
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Fri, 22 Nov 2024 20:41 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Fri, 22 Nov 2024 20:41:21 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <vhqq9g$1b2t7$2@dont-email.me>
References: <uu54la$3su5b$6@dont-email.me> <87edbtz43p.fsf@tudado.org>
<0d2cnVzOmbD6f4z7nZ2dnZfqnPudnZ2d@brightview.co.uk>
<uusur7$2hm6p$1@dont-email.me> <vdf096$2c9hb$8@dont-email.me>
<87a5fdj7f2.fsf@doppelsaurus.mobileactivedefense.com>
<ve83q2$33dfe$1@dont-email.me> <vgsbrv$sko5$1@dont-email.me>
<vgtslt$16754$1@dont-email.me> <86frnmmxp7.fsf@red.stonehenge.com>
<vhk65t$o5i$1@dont-email.me> <vhki79$2pho$1@dont-email.me>
<vhkkka$3dja$1@dont-email.me> <vhll6c$9gjn$1@dont-email.me>
<vhmq7d$ig5d$1@dont-email.me> <vhoaqp$qjkl$4@dont-email.me>
<vhpr06$15kuj$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 22 Nov 2024 21:41:21 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d0640d653b3828f8761808e02c741927";
logging-data="1412007"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19kOMlpWK1WtvkmPUpoaimm"
User-Agent: Pan/0.161 (Chasiv Yar; )
Cancel-Lock: sha1:fxVWrjR5UBGdt1quDgivK7GxApw=
View all headers

On Fri, 22 Nov 2024 12:47:16 +0100, Janis Papanagnou wrote:

> On 21.11.2024 23:05, Lawrence D'Oliveiro wrote:
>
>> Another handy one is “\b” for word boundaries.
>
> I prefer \< and \> (that are quite commonly used) for such structural
> things ...

“\<” only matches the beginning of a word, “\>” only matches the end,
“\b” matches both
<https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexp-Backslash.html>.

Subject: Re: Command Languages Versus Programming Languages
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Sat, 23 Nov 2024 11:40 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Muttley@dastardlyhq.com
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Sat, 23 Nov 2024 11:40:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <vhsevk$1mk1v$1@dont-email.me>
References: <uu54la$3su5b$6@dont-email.me> <87edbtz43p.fsf@tudado.org>
<0d2cnVzOmbD6f4z7nZ2dnZfqnPudnZ2d@brightview.co.uk>
<uusur7$2hm6p$1@dont-email.me> <vdf096$2c9hb$8@dont-email.me>
<87a5fdj7f2.fsf@doppelsaurus.mobileactivedefense.com>
<ve83q2$33dfe$1@dont-email.me> <vgsbrv$sko5$1@dont-email.me>
<vgtslt$16754$1@dont-email.me> <86frnmmxp7.fsf@red.stonehenge.com>
<vhk65t$o5i$1@dont-email.me> <vhkev7$29sc$1@dont-email.me>
<20241121110710.49@kylheku.com> <vhpl9c$14mdr$1@dont-email.me>
<20241122101217.134@kylheku.com>
Injection-Date: Sat, 23 Nov 2024 12:40:37 +0100 (CET)
Injection-Info: dont-email.me; posting-host="5c4dac7c3883c150147afc8de184753b";
logging-data="1790015"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/KSVvseyh9HqgkCdwiIWuV"
Cancel-Lock: sha1:O7/2kSAmAWHgmHW7JJZ/WcVtuAs=
View all headers

On Fri, 22 Nov 2024 18:18:04 -0000 (UTC)
Kaz Kylheku <643-408-1753@kylheku.com> gabbled:
>On 2024-11-22, Muttley@DastartdlyHQ.org <Muttley@DastartdlyHQ.org> wrote:
>> Its not that simple I'm afraid since comments can be commented out.
>
>Umm, no.

Umm, yes, they can.

>> eg:
>>
>> // int i; /*
>
>This /* sequence is inside a // comment, and so the machinery that
>recognizes /* as the start of a comment would never see it.

Yes, thats kind of the point. You seem to be arguing against yourself.

>> A C99 and C++ compiler would see "int j" and compile it, a regex would
>> simply remove everything from the first /* to */.
>
>No, it won't, because that's not how regexes are used in a lexical

Yes, it will.

>> Also the same probably applies to #ifdef's.
>
>Lexically analyzing C requires implementing the translation phases
>as described in the standard. There are preprocessor phases which
>delimit the input into preprocessor tokens (pp-tokens). Comments
>are stripped in preprocessing. But logical lines (backslash
>continuations) are recognized below comments; i.e. this is one
>comment:

Not sure what your point is. A regex cannot be used to parse C comments because
its doesn't know C/C++ grammar.

Subject: Re: Command Languages Versus Programming Languages
From: Ed Morton
Newsgroups: comp.unix.shell, comp.unix.programmer, comp.lang.misc
Organization: A noiseless patient Spider
Date: Sun, 24 Nov 2024 00:17 UTC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Sat, 23 Nov 2024 18:17:41 -0600
Organization: A noiseless patient Spider
Lines: 97
Message-ID: <vhtrb4$1tms9$1@dont-email.me>
References: <uu54la$3su5b$6@dont-email.me> <87edbtz43p.fsf@tudado.org>
<0d2cnVzOmbD6f4z7nZ2dnZfqnPudnZ2d@brightview.co.uk>
<uusur7$2hm6p$1@dont-email.me> <vdf096$2c9hb$8@dont-email.me>
<87a5fdj7f2.fsf@doppelsaurus.mobileactivedefense.com>
<ve83q2$33dfe$1@dont-email.me> <vgsbrv$sko5$1@dont-email.me>
<vgtslt$16754$1@dont-email.me> <86frnmmxp7.fsf@red.stonehenge.com>
<vhk65t$o5i$1@dont-email.me> <vhki79$2pho$1@dont-email.me>
<vhl0m3$5mu9$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 24 Nov 2024 01:17:44 +0100 (CET)
Injection-Info: dont-email.me; posting-host="8ae094dd2eff3c26a0f410117ac0acbd";
logging-data="2022281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19h1gPbb/k9ak2iUuw6IEXM"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:8wZZCU6pfSuVc/gANXhxY2jcFo4=
X-Antivirus: Avast (VPS 241123-4, 11/23/2024), Outbound message
X-Antivirus-Status: Clean
In-Reply-To: <vhl0m3$5mu9$1@dont-email.me>
Content-Language: en-US
View all headers

On 11/20/2024 9:53 AM, Janis Papanagnou wrote:
> On 20.11.2024 12:46, Ed Morton wrote:
>>
>> Definitely. The most relevant statement about regexps is this:
>>
>>> Some people, when confronted with a problem, think "I know, I'll use
>>> regular expressions." Now they have two problems.
>
> (Worth a scribbling on a WC wall.)
>
>>
>> Obviously regexps are very useful and commonplace but if you find you
>> have to use some online site or other tools to help you write/understand
>> one or just generally need more than a couple of minutes to
>> write/understand it then it's time to back off and figure out a better
>> way to write your code for the sake of whoever has to read it 6 months
>> later (and usually for robustness too as it's hard to be sure all rainy
>> day cases are handled correctly in a lengthy and/or complicated regexp).
>
> Regexps are nothing for newbies.
>
> The inherent fine thing with Regexps is that you can incrementally
> compose them[*].[**]
>
> It seems you haven't found a sensible way to work with them?
> (And I'm really astonished about that since I know you worked with
> Regexps for years if not decades.)

I have no problem working with regexps, I just don't write lengthy or
complicated regexps, just brief, simple BREs or EREs, and I don't
restrict myself to trying to solve problems with a single regexp.

> In those cases where Regexps *are* the tool for a specific task -
> I don't expect you to use them where they are inappropriate?! -

Right, I don't, but I see many people using them for tasks that could be
done more clearly and robustly if not done with a single regexp.

> what would be the better solution[***] then?

It all depends on the problem. For example, if you need to match an
input string that must contain each of a, b, and c in any order then you
could do that in awk with this regexp or similar:

awk '/(a.*(b.*c|c.*b))|(b.*(a.*c|c.*a))|(c.*(a.*b|b.*a))/'

or you could do it with this condition comprised of regexp segments:

awk '/a/ && /b/ && /c/'

I would prefer the second solution as it's more concise and easier to
enhance (try adding "and d" to both).

As another example, someone on StackOverflow recently said they had
written the following regexp to isolate the last string before a set of
parens in a line that contains multiple such strings, some of them
nested, and they said it works in python:

^(?:^[^(]+\([^)]+\)
\(([^(]+)\([^)]+\)\))|[^(]+\(([^(]+)\([^)]+\),\s([^\(]+)\([^)]+\)\s\([^\)]+\)\)|(?:(?:.*?)\((.*?)\(.*?\)\))|(?:[^(]+\(([^)]+)\))$

I personally wouldn't consider anything remotely as lengthy or
complicated as that regexp despite their assurances that it works, I'd
use this any-awk script or similar instead:

{
rec = $0
while ( match(rec, /\([^()]*)/) ) {
tgt = substr($0,RSTART+1,RLENGTH-2)
rec = substr(rec,1,RSTART-1) RS substr(rec,RSTART+1,RLENGTH-2)
RS substr(rec,RSTART+RLENGTH)
}
gsub(/ *\([^()]*) */, "", tgt)
print tgt
}

It's a bit more code but, unlike that regexp, anyone assigned to
maintain this code in future can tell what it does with just a little
thought (and maybe adding a debugging print in the loop if they aren't
very familiar with awk), can then be sure it does what is required and
nothing else, and could easily maintain/enhance it if necessary.

Ed.

>
> Janis
>
> [*] Like the corresponding FSMs.
>
> [**] And you can also decompose them if they are merged in a huge
> expression, too large for you to grasp it. (BTW, I'm doing such
> decompositions also with other expressions in program code that
> are too bulky.)
>
> [***] Can you answer the question that another poster failed to do?
>

Pages:1234567

rocksolid light 0.9.8
clearnet tor