Path: csiph.com!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc Subject: Re: Command Languages Versus Programming Languages Date: Fri, 29 Mar 2024 17:08:35 -0700 Organization: None to speak of Lines: 31 Message-ID: <87a5mgshrw.fsf@nosuchdomain.example.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 30 Mar 2024 00:08:37 +0100 (CET) Injection-Info: dont-email.me; posting-host="55d3bec1253354bc3d638b21ffa9fc4c"; logging-data="632026"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/IYfFWW6JCKdiEj+iW2S57" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:1FXMFLIaw71D/6AMnx0XZZPFLYA= sha1:YeRNsDZkVEzwFZBJQv4BDequZg4= Xref: csiph.com comp.unix.shell:24845 comp.unix.programmer:15593 comp.lang.misc:10266 Lawrence D'Oliveiro writes: > On Sat, 30 Mar 2024 00:14:42 +0100, Janis Papanagnou wrote: >> What I was saying is that there's initially literal program text >> that is transformed to tokens in the lexical analysis, and then >> further processed. > > In a shell language, that is “further processed” as literal text, except > for any instances of substitution markers. > >>> in a programming language, you have the assumption that >>> “everything is a program construct until indicated otherwise”. >> >> So what is 'for i in a ; do ... ; done' then in your world? > > “for” is just the name of a command, like any other. In POSIX, this one > happens to be built into the shell; it might not in other shells. "for" is not just a command. It's a keyword, part of the shell language syntax. By contrast, "echo" is a command that may be built into the shell or not, and behaves similarly either way. There's no way to implement "for" as an external command. (Very early UNIX shells had "goto" as an external command. The implementation was convoluted.) -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Medtronic void Void(void) { Void(); } /* The recursive call of the void */