Gödel, Escher, Bach An Eternal Golden Braid by Douglas R. Hofstadter

(Dana P.) #1
guage.) In the mid-1950's, successful programs called compilers were written
whose function was to carry out the translation from compiler languages to
machine language.
Also, interpreters were invented. Like compilers, interpreters translate
from high-level languages into machine language, but instead of translat-
ing all the statements first and then executing the machine code, they read
one line and execute it immediately. This has the advantage that a user
need not have written a complete program to use an interpreter. He may
invent his program line by line, and test it out as he goes along. Thus, an
interpreter is to a compiler as a simultaneous interpreter is to a translator
of a written speech. One of the most important and fascinating of all
computer languages is LISP (standing for "List Processing"), which was
invented by John McCarthy around the time Algol was invented. Sub-
sequently, LISP has enjoyed great popularity with workers in Artificial
Intelligence.
There is one interesting difference between the way interpreters work
and compilers work. A compiler takes input (a finished Algol program, for
instance) and produces output (a long sequence of machine language
instructions). At this point, the compiler has done its duty. The output is
then given to the computer to run. By contrast, the interpreter is constantly
running while the programmer types in one LISP statement after another,
and each one gets executed then and there. But this doesn't mean that each
statement gets first translated, then executed, for then an interpreter
would be nothing but a line-by-line compiler. Instead, in an interpreter, the
operations of reading a new line, "understanding" it, and executing it are
intertwined: they occur simultaneously.
Here is the idea, expanded a little more. Each time a new line of LISP
is typed in, the interpreter tries to process it. This means that the interpret-
er jolts into action, and certain (machine language) instructions inside it get
executed. Precisely which ones get executed depends on the LISP statement
itself, of course. There are many JUMP instructions inside the interpreter,
so that the new line of LISP may cause control to move around in a
complex way-forwards, backwards, then forwards again, etc. Thus, each
LISP statement gets converted into a "pathway" inside the interpreter, and
the act of following that pathway achieves the desired effect.
Sometimes it is helpful to think of the LISP statements as mere pieces
of data which are fed sequentially to a constantly running machine lan-
guage program (the LISP interpreter). When you think of things this way,
you get a different image of the relation between a program written in a
higher-level language and the machine which is executing it.

Bootstrapping

Of course a compiler, being itself a program, has to be written in some
language. The first compilers were written in assembly language, rather
than machine language, thus taking full advantage of the already ac-

Levels of Description, and Computer Systems 293

Free download pdf