Sujet : Re: Command Languages Versus Programming Languages
De : rweikusat (at) *nospam* talktalk.net (Rainer Weikusat)
Groupes : comp.unix.shell comp.unix.programmer comp.lang.miscDate : 12. Oct 2024, 14:37:24
Autres entêtes
Message-ID : <87h69hfnmz.fsf@doppelsaurus.mobileactivedefense.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Muttley@DastartdlyHQ.org writes:
On Fri, 11 Oct 2024 20:58:26 -0000 (UTC)
Lawrence D'Oliveiro <ldo@nz.invalid> boring babbled:
On Fri, 11 Oct 2024 15:15:57 -0000 (UTC), Muttley wrote:
>
On Fri, 11 Oct 2024 15:47:06 +0100
Rainer Weikusat <rweikusat@talktalk.net>:
>
The Perl compiler turns Perl source code into a set of (that's a
Does it produce a standalone binary as output? No, so its an intepreter
not a compiler.
>
There are two parts: the interpreter interprets code generated by the compiler.
>
Code generated by a compiler does not require an interpreter.
Indeed. As far as I know the term, an interpreter is something which
reads text from a file, parses it an checks it for syntax errors
and then executes the code as soon as enough of it has been gathered to
allow for execution of something, ie, a complete statement. This read,
check and parse, execute cycle is repeated until the program
terminates.
Example for this:
[
rw@doppelsaurus]/tmp#cat a.sh
ed a.sh <<'TT' >/dev/null 2>&1
9,$d
wq
TT
echo `expr $i + 0`
i=`expr $i + 1`
test $i = 11 && exit
sed -n '5,8p' a.sh | tee -a a.sh >/dev/null
This is a script printing the numbers from 0 to 10 by exploiting
the property that /bin/sh is an interpeter.
In contrast to this, a compiler reads the source code completely, parses
and checks it and then transforms it into some sort of "other
representation" which can be executed without dealing with the source
code (text) again. Eg, the Java compiler transforms Java source code
into Java bytecode which is then usually executed by the jvm. OTOH,
processors capable of executing Java bytecode directly exit or at least
used to exist. ARM CPUs once had an extension for that (Jazelle).