Re: Command Languages Versus Programming Languages

Liste des GroupesRevenir à cu shell 
Sujet : Re: Command Languages Versus Programming Languages
De : rweikusat (at) *nospam* talktalk.net (Rainer Weikusat)
Groupes : comp.unix.shell comp.unix.programmer comp.lang.misc
Date : 13. Oct 2024, 21:25:51
Autres entêtes
Message-ID : <878quryckw.fsf@doppelsaurus.mobileactivedefense.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Christian Weisgerber <naddy@mips.inka.de> writes:
On 2024-10-12, Rainer Weikusat <rweikusat@talktalk.net> wrote:
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.
>
I don't really want to participate in this discussion, but what
you're saying there is that all those 1980s home computer BASIC
interpreters, which read and tokenized a program before execution,
were actually compilers.

If they contained something which compiled all of the source code prior
to execution in order to transform it some actually executable
intermediate representation whose execution didn't require future access
to the source code and thus, also didn't include checking the source
code for syntactical correctness, this something can be called a
compiler and the execution engine some sort of virtual machine which
could principally execute programs compiled from source code in any
programming language.

But judging from Wikipedia, Murkysoft Basic stored programs as linked
list of preprocessed lines and interpreted these, ie, doing string
lookups of keywords from the source code at run time in order to
determine what code to execute. Insofar I vaguely remember this from
Apple //c BASIC (has been a while) syntax errors would also be found at
runtime, ie, once execution reached the line with the error. This would
make it an interpreter.

In constrast to this, this somewhat amusing small Perl program:

while (<>) {
    while (length) {
        s/^(\w+)// and print(scalar reverse($1));
        s/^(\W+)// and print($1);
    }
}

[reads lines from stdin and prints them with each word reversed]

gets translated into an op tree whose textual representation (perl
-MO=Concise,-basic)  looks like
this:

y  <@> leave[1 ref] vKP/REFC ->(end)
1     <0> enter v ->2
2     <;> nextstate(main 1 a.pl:1) v:{ ->3
x     <2> leaveloop vKP/2 ->y
3        <{> enterloop(next->r last->x redo->4) v ->s
-        <1> null vK/1 ->x
w           <|> and(other->4) vK/1 ->x
v              <1> defined sK/1 ->w
-                 <1> null sK/2 ->v
-                    <1> ex-rv2sv sKRM*/1 ->t
s                       <#> gvsv[*_] s ->t
u                    <1> readline[t2] sKS/1 ->v
t                       <#> gv[*ARGV] s ->u
-              <@> lineseq vKP ->-
4                 <;> nextstate(main 3 a.pl:2) v:{ ->5
q                 <2> leaveloop vKP/2 ->r
5                    <{> enterloop(next->m last->q redo->6) v ->n
-                    <1> null vK/1 ->q
p                       <|> and(other->6) vK/1 ->q
o                          <1> length[t4] sK/BOOL,1 ->p
-                             <1> ex-rv2sv sK/1 ->o
n                                <#> gvsv[*_] s ->o
-                          <@> lineseq vKP ->-
6                             <;> nextstate(main 5 a.pl:3) v:{ ->7
-                             <1> null vK/1 ->f
9                                <|> and(other->a) vK/1 ->f
8                                   </> subst(/"^(\w+)"/) sK/BOOL ->9
7                                      <$> const[PV ""] s ->8
e                                   <@> print vK ->f
a                                      <0> pushmark s ->b
-                                      <1> scalar sK/1 ->e
d                                         <@> reverse[t6] sK/1 ->e
b                                            <0> pushmark s ->c
-                                            <1> ex-rv2sv sK/1 ->d
c                                               <#> gvsv[*1] s ->d
f                             <;> nextstate(main 5 a.pl:4) v:{ ->g
-                             <1> null vK/1 ->m
i                                <|> and(other->j) vK/1 ->m
h                                   </> subst(/"^(\W+)"/) sK/BOOL ->i
g                                      <$> const[PV ""] s ->h
l                                   <@> print vK ->m
j                                      <0> pushmark s ->k
-                                      <1> ex-rv2sv sK/1 ->l
k                                         <#> gvsv[*1] s ->l
m                             <0> unstack v ->n
r                 <0> unstack v ->s

Each line represents a node on this tree and the names refer to builtin
'ops'. In the actual tree, they're pointers to C functions and execution
happens as preorder traversal of this tree and invoking the op functions
from the leaves to root to produce the arguments necessary for invoking
op functions residing at a higher level in this tree.

Modules for writing this internal representation to a file and loading
it back from there and even for translating it into C exist. They're
just not part of the core distribution anymore.

Date Sujet#  Auteur
29 Mar 24 * Command Languages Versus Programming Languages708Lawrence D'Oliveiro
29 Mar 24 +- Re: Command Languages Versus Programming Languages1candycanearter07
29 Mar 24 +* Re: Command Languages Versus Programming Languages19Janis Papanagnou
29 Mar 24 i+* Re: Command Languages Versus Programming Languages15Lawrence D'Oliveiro
30 Mar 24 ii`* Re: Command Languages Versus Programming Languages14Janis Papanagnou
30 Mar 24 ii +* Re: Command Languages Versus Programming Languages3Janis Papanagnou
30 Mar 24 ii i`* Re: Command Languages Versus Programming Languages2Keith Thompson
30 Mar 24 ii i `- Re: Command Languages Versus Programming Languages1Janis Papanagnou
30 Mar 24 ii +* Re: Command Languages Versus Programming Languages6Lawrence D'Oliveiro
30 Mar 24 ii i+* Re: Command Languages Versus Programming Languages3Keith Thompson
30 Mar 24 ii ii`* Re: Command Languages Versus Programming Languages2Lawrence D'Oliveiro
30 Mar 24 ii ii `- Re: Command Languages Versus Programming Languages1Keith Thompson
30 Mar 24 ii i`* Re: Command Languages Versus Programming Languages2Janis Papanagnou
30 Mar 24 ii i `- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
30 Mar 24 ii +* Re: Command Languages Versus Programming Languages3Keith Thompson
30 Mar 24 ii i`* Re: Command Languages Versus Programming Languages2Janis Papanagnou
30 Mar 24 ii i `- Re: Command Languages Versus Programming Languages1Keith Thompson
31 Mar 24 ii `- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
29 Mar 24 i`* Re: Command Languages Versus Programming Languages3Stefan Ram
30 Mar 24 i `* Re: Command Languages Versus Programming Languages2Janis Papanagnou
30 Mar 24 i  `- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
29 Mar 24 +* Re: Command Languages Versus Programming Languages168Muttley
29 Mar 24 i+- Re: Command Languages Versus Programming Languages1Josef Möllers
29 Mar 24 i+* Re: Command Languages Versus Programming Languages9Richard Kettlewell
29 Mar 24 ii`* Re: Command Languages Versus Programming Languages8Muttley
29 Mar 24 ii `* Re: Command Languages Versus Programming Languages7Kaz Kylheku
29 Mar 24 ii  `* Re: Command Languages Versus Programming Languages6Muttley
29 Mar 24 ii   `* Re: Command Languages Versus Programming Languages5Kaz Kylheku
30 Mar 24 ii    `* Re: Command Languages Versus Programming Languages4Muttley
30 Mar 24 ii     +- Re: Command Languages Versus Programming Languages1Janis Papanagnou
30 Mar 24 ii     `* Re: Command Languages Versus Programming Languages2Kaz Kylheku
1 Apr 24 ii      `- Re: Command Languages Versus Programming Languages1Muttley
29 Mar 24 i`* Re: Command Languages Versus Programming Languages157John Ames
29 Mar 24 i +* Re: Command Languages Versus Programming Languages155Muttley
29 Mar 24 i i+- Re: Command Languages Versus Programming Languages1John Ames
29 Mar 24 i i+* Re: Command Languages Versus Programming Languages149Kaz Kylheku
29 Mar 24 i ii`* Re: Command Languages Versus Programming Languages148Muttley
29 Mar 24 i ii +* Re: Command Languages Versus Programming Languages146Kaz Kylheku
29 Mar 24 i ii i+* Re: Command Languages Versus Programming Languages4David W. Hodgins
29 Mar 24 i ii ii+* Re: Command Languages Versus Programming Languages2Johanne Fairchild
30 Mar 24 i ii iii`- Re: Command Languages Versus Programming Languages1David W. Hodgins
30 Mar 24 i ii ii`- Re: Command Languages Versus Programming Languages1Janis Papanagnou
30 Mar 24 i ii i`* Re: Command Languages Versus Programming Languages141Muttley
30 Mar 24 i ii i `* Re: Command Languages Versus Programming Languages140Kaz Kylheku
1 Apr 24 i ii i  `* Re: Command Languages Versus Programming Languages139Muttley
1 Apr 24 i ii i   +* Re: Command Languages Versus Programming Languages137Johanne Fairchild
1 Apr 24 i ii i   i`* Re: Command Languages Versus Programming Languages136Muttley
1 Apr 24 i ii i   i +- Re: Command Languages Versus Programming Languages1Kaz Kylheku
2 Apr 24 i ii i   i `* Re: Command Languages Versus Programming Languages134Johanne Fairchild
2 Apr 24 i ii i   i  +* Re: Command Languages Versus Programming Languages113ram@zedat.fu-berlin.de (Stefan Ram)
2 Apr 24 i ii i   i  i+* Re: Command Languages Versus Programming Languages111Stefan Ram
2 Apr 24 i ii i   i  ii+* Re: Command Languages Versus Programming Languages109Stefan Ram
3 Apr 24 i ii i   i  iii`* Re: Command Languages Versus Programming Languages108Lawrence D'Oliveiro
3 Apr 24 i ii i   i  iii `* Re: Command Languages Versus Programming Languages107David Brown
3 Apr 24 i ii i   i  iii  +- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
3 Apr 24 i ii i   i  iii  +- Re: Command Languages Versus Programming Languages1John Ames
3 Apr 24 i ii i   i  iii  `* Re: Command Languages Versus Programming Languages104Keith Thompson
3 Apr 24 i ii i   i  iii   +* Re: Command Languages Versus Programming Languages99Richard Kettlewell
4 Apr 24 i ii i   i  iii   i+- Re: Command Languages Versus Programming Languages1Muttley
4 Apr 24 i ii i   i  iii   i`* Re: Command Languages Versus Programming Languages97Stefan Ram
5 Apr 24 i ii i   i  iii   i `* Re: Command Languages Versus Programming Languages96Lawrence D'Oliveiro
5 Apr 24 i ii i   i  iii   i  +* Re: Command Languages Versus Programming Languages49Muttley
5 Apr 24 i ii i   i  iii   i  i+* Re: Command Languages Versus Programming Languages3candycanearter07
5 Apr 24 i ii i   i  iii   i  ii`* Re: Command Languages Versus Programming Languages2Muttley
6 Apr 24 i ii i   i  iii   i  ii `- Re: Command Languages Versus Programming Languages1candycanearter07
6 Apr 24 i ii i   i  iii   i  i`* Re: Command Languages Versus Programming Languages45Lawrence D'Oliveiro
6 Apr 24 i ii i   i  iii   i  i `* Re: Command Languages Versus Programming Languages44Alan Bawden
6 Apr 24 i ii i   i  iii   i  i  +* Re: Command Languages Versus Programming Languages13Lawrence D'Oliveiro
8 Apr 24 i ii i   i  iii   i  i  i`* Re: Command Languages Versus Programming Languages12John Ames
9 Apr 24 i ii i   i  iii   i  i  i `* Re: Command Languages Versus Programming Languages11Lawrence D'Oliveiro
9 Apr 24 i ii i   i  iii   i  i  i  +* Re: Command Languages Versus Programming Languages9John Ames
9 Apr 24 i ii i   i  iii   i  i  i  i`* Re: Command Languages Versus Programming Languages8Richard Kettlewell
9 Apr 24 i ii i   i  iii   i  i  i  i +* Re: Command Languages Versus Programming Languages2Janis Papanagnou
9 Apr 24 i ii i   i  iii   i  i  i  i i`- Re: Command Languages Versus Programming Languages1Richard Kettlewell
9 Apr 24 i ii i   i  iii   i  i  i  i `* Re: Command Languages Versus Programming Languages5David Brown
9 Apr 24 i ii i   i  iii   i  i  i  i  `* Re: Command Languages Versus Programming Languages4Lawrence D'Oliveiro
9 Apr 24 i ii i   i  iii   i  i  i  i   `* Re: Command Languages Versus Programming Languages3David Brown
10 Apr 24 i ii i   i  iii   i  i  i  i    `* Re: Command Languages Versus Programming Languages2Lawrence D'Oliveiro
10 Apr 24 i ii i   i  iii   i  i  i  i     `- Re: Command Languages Versus Programming Languages1Kaz Kylheku
9 Apr 24 i ii i   i  iii   i  i  i  `- Re: Command Languages Versus Programming Languages1Kaz Kylheku
6 Apr 24 i ii i   i  iii   i  i  +* Re: Command Languages Versus Programming Languages3Kaz Kylheku
6 Apr 24 i ii i   i  iii   i  i  i`* Re: Command Languages Versus Programming Languages2David Brown
6 Apr 24 i ii i   i  iii   i  i  i `- Re: Command Languages Versus Programming Languages1Muttley
6 Apr 24 i ii i   i  iii   i  i  +- Re: Command Languages Versus Programming Languages1candycanearter07
6 Apr 24 i ii i   i  iii   i  i  `* Re: Command Languages Versus Programming Languages26Muttley
7 Apr 24 i ii i   i  iii   i  i   +* Re: Command Languages Versus Programming Languages22Alan Bawden
8 Apr 24 i ii i   i  iii   i  i   i`* Re: Command Languages Versus Programming Languages21Muttley
8 Apr 24 i ii i   i  iii   i  i   i `* Re: Command Languages Versus Programming Languages20David Brown
8 Apr 24 i ii i   i  iii   i  i   i  `* Re: Command Languages Versus Programming Languages19Muttley
8 Apr 24 i ii i   i  iii   i  i   i   +* Words to the wise (Was: Command Languages Versus Programming Languages)2Kenny McCormack
8 Apr 24 i ii i   i  iii   i  i   i   i`- Re: Words to the wise (Was: Command Languages Versus Programming Languages)1Muttley
8 Apr 24 i ii i   i  iii   i  i   i   `* Re: Command Languages Versus Programming Languages16Kaz Kylheku
8 Apr 24 i ii i   i  iii   i  i   i    +* Phrases that should be banned on Usenet (Was: Command Languages Versus Programming Languages)9Kenny McCormack
9 Apr 24 i ii i   i  iii   i  i   i    i`* Re: Phrases that should be banned on Usenet (Was: Command Languages Versus Programming Languages)8Janis Papanagnou
9 Apr 24 i ii i   i  iii   i  i   i    i +- Re: Phrases that should be banned on Usenet (Was: Command Languages Versus Programming Languages)1D
9 Apr 24 i ii i   i  iii   i  i   i    i `* Re: Phrases that should be banned on Usenet (Was: Command Languages Versus Programming Languages)6candycanearter07
9 Apr 24 i ii i   i  iii   i  i   i    i  `* Re: Phrases that should be banned on Usenet (Was: Command Languages Versus Programming Languages)5Janis Papanagnou
9 Apr 24 i ii i   i  iii   i  i   i    i   +- Re: Phrases that should be banned on Usenet (Was: Command Languages Versus Programming Languages)1candycanearter07
10 Apr 24 i ii i   i  iii   i  i   i    i   `* Re: Phrases that should be banned on Usenet (Was: Command Languages Versus Programming Languages)3Lawrence D'Oliveiro
10 Apr 24 i ii i   i  iii   i  i   i    i    +- Re: Phrases that should be banned on Usenet (Was: Command Languages Versus Programming Languages)1Chris Elvidge
10 Apr 24 i ii i   i  iii   i  i   i    i    `- Re: Phrases that should be banned on Usenet (Was: Command Languages Versus Programming Languages)1candycanearter07
9 Apr 24 i ii i   i  iii   i  i   i    `* Re: Command Languages Versus Programming Languages6Muttley
8 Apr 24 i ii i   i  iii   i  i   +- [meta] Re: Command Languages Versus Programming Languages1Janis Papanagnou
10 Apr 24 i ii i   i  iii   i  i   `* Re: Command Languages Versus Programming Languages2Keith Thompson
5 Apr 24 i ii i   i  iii   i  `* Re: Command Languages Versus Programming Languages46Janis Papanagnou
3 Apr 24 i ii i   i  iii   `* Re: Command Languages Versus Programming Languages4David Brown
2 Apr 24 i ii i   i  ii`- Re: Command Languages Versus Programming Languages1Kaz Kylheku
2 Apr 24 i ii i   i  i`- Re: Command Languages Versus Programming Languages1Kaz Kylheku
2 Apr 24 i ii i   i  `* Re: Command Languages Versus Programming Languages20Lawrence D'Oliveiro
1 Apr 24 i ii i   `- Re: Command Languages Versus Programming Languages1Lawrence D'Oliveiro
1 Apr 24 i ii `- Re: Command Languages Versus Programming Languages1Andreas Eder
29 Mar 24 i i+- Re: Command Languages Versus Programming Languages1Christian Weisgerber
30 Mar 24 i i+* Re: Command Languages Versus Programming Languages2David Brown
30 Sep 24 i i`- Re: Command Languages Versus Programming Languages1Bozo User
29 Mar 24 i `- Re: Command Languages Versus Programming Languages1Kaz Kylheku
29 Mar 24 +* Re: Command Languages Versus Programming Languages510Johanne Fairchild
29 Mar 24 +* Re: Command Languages Versus Programming Languages2David Brown
30 Mar 24 +* Re: Command Languages Versus Programming Languages3Dmitry A. Kazakov
30 Sep 24 `* Re: Command Languages Versus Programming Languages4Bozo User

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal