Sujet : Re: Command Languages Versus Programming Languages
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.unix.shell comp.unix.programmer comp.lang.miscDate : 30. Mar 2024, 08:47:14
Autres entêtes
Organisation : Stefan Ram
Message-ID : <scripting-20240330084331@ram.dialup.fu-berlin.de>
References : 1 2 3 4
Johanne Fairchild <
jfairchild@tudado.org> wrote or quoted:
ram@zedat.fu-berlin.de (Stefan Ram) writes:
Johanne Fairchild <jfairchild@tudado.org> wrote or quoted:
A scripting language is a programming language made for a hypothetical
machine, not too different from a programming language made for a real
machine, one made of hardware.
C is clearly a programming language, yet its specification
says, "The semantic descriptions in this document describe
the behavior of an abstract machine". And you cannot buy
this abstract C machine as a piece of hardware anywhere!
Of course. :) But we both know what that means. It's abstract because
there are so many real machines for which this abstract one is an
abstraction of. And the real ones are the target of the language.
If you want to see it this way ...
But look at Pascal, Java, or Python. They are usually compiled
into an intermediate code (called "p-code" in the case of
Pascal) which is then interpreted (the interpreter is called
"JVM" in the case of Java). Yet, we think of Pascal and Java
as programming languages and of Python as a scripting language.
But this is actually an implementation detail: Java also can
be compiled into machine code.
In any case, we can write a small batch file "execute" which
can be called for source code in any programming language and
will execute it:
execute Main.pas
execute Main.java
execute Main.py
execute main.c
execute main.cpp
execute main.bas
execute main.bat
...
They all will print "Hello World". Whether the execution happens
via translation to machine code or via interpretation by another
program or by a mixture of both is just an implementation
detail of "execute", that usually will not matter much for the
programmer. And often for the same language, one is free to
either compile it to machine language or interpret it via another
program.
Some language, like LISP or Python, have "eval": These languages
still can be compiled, but they require an interpreter at run-
time. Java often is executed by interpretation first, but when
the "Hotspot" interpreter sees that some code is executed often,
it will then decide /at run-time/ to compile it into actual
machine code! (And there are Python implementations that run
on the JVM.)
How can such implementation details matter for the question whether
a language is called a programming language or a scripting language,
when the programmer often does not even need to know about them?
Yes, there also are C interpreters IIRC, but they are rare.