Sujet : Re: Command Languages Versus Programming Languages
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.unix.shell comp.unix.programmer comp.lang.miscDate : 30. Mar 2024, 01:08:35
Autres entêtes
Organisation : None to speak of
Message-ID : <87a5mgshrw.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Lawrence D'Oliveiro <
ldo@nz.invalid> 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.comWorking, but not speaking, for Medtronicvoid Void(void) { Void(); } /* The recursive call of the void */