Lisp Doc
Lisp Doc
COPYRIGHT NOTICE
The following copyright notice applies to both the LISP source and binary:
(1) If any part of the source code for this software is distributed,
then this copyright and no-warranty notice must be included
unaltered; and any additions, deletions, or changes to the original
files must be clearly indicated in accompanying documentation.
(3) Permission for use of this software is granted only if the user
accepts full responsibility for any undesirable consequences; the
authors accept NO LIABILITY for damages of any kind.
1. Introduction
This package contains the source and binary for PDP-1 LISP, a LISP interpreter
for the PDP-1. This historic program was written by Peter Deutsch in 1963 and
1964. It was the first LISP interpreter on an interactive system and one of
the first in general use.
cc macro1.c -o macro1
macro1 lisp.mac
The assembler is NOT a line for line reconstruction of PDP-1 macro; it contains
exactly enough functionality to assemble LISP, and no more.
The following comments were supplied by Peter Deutsch, the program's author:
"I wrote PDP-1 Lisp because I had a strong mathematical bent, I'd become
intrigued with the Lisp language as a result of having somehow picked up a
copy of the original Lisp 1.5 Programmer's Manual at MIT, and I wanted to
have an interactive Lisp implementation to play with rather than having to
submit card decks at the MIT Computation Center. (Bear in mind that I was
in high school at the time -- 1960-1964.) I'd ingratiated myself with the
folks at the TX-0 (and later PDP-1) lab at MIT, so I had pretty free access
to the machine there.
"I think the most interesting aspect of the design philosophy, in retrospect,
was that I instinctively homed in on the fact that when implementing a
language using an interpreter, operations in the language that were
documented as primitive could in fact be implemented within the language
(i.e., interpretively) using simpler primitives. (Maybe this fact was
common knowledge at the time, and I'm just not remembering it.) Thus
operations like CAAR were actually implemented in Lisp as (LAMBDA (X) (CAR
(CAR X))). This was a pure time/space tradeoff, since Lisp S-expressions
took less space than PDP-1 machine code. I used this approach to tremendous
advantage in my subsequent Lisp work (my PDP-1 Lisp implementation, as you
probably know, was extensively rewritten at BB&N to become the conceptual
predecessor of BBN-Lisp, which in turn engendered Interlisp), and also in
the Smalltalk and PostScript implementations I was involved with later on.
"I did all the development on a machine whose only long-term non-volatile
storage device was paper tape: the word processor read in a paper tape,
allowed you to edit, and then punched out an entire new tape. (When I
arrived at MIT, the word processor, Expensive Typewriter, didn't have any
facilities for backing up in the input, since it was designed as a
tape-to-tape editor: I rewrote it to be RAM-based, and added a lot of new
facilities.) You then had to run the edited tape through the assembler,
producing another tape of the executable, and then run *that* tape back into
the machine for execution. (I also hacked up Expensive Typewriter to
integrate directly with the assembler, using the machine's swapping drum to
pass the source code, so the intermediate tape was no longer needed; in
fact, as I recall, you could even defer punching out the edited tape.) This
was another theme that has run through a lot of my subsequent career:
sometimes the tools I developed along the way were as interesting as
whatever it was that I was developing using those tools."
3. User's Guide
Quoting from the original operating instructions, "At this point, the LISP
system is ready for manual typewriter input. As soon as the operator types,
for example:
together with a final space at the end of the last right parenthesis, the
computer takes control of the typewriter, impulses a carriage return, and
then types out:
which of course is the correct answer. Similarly for the other suggested
test sequences in Table 2 below."
Table 1
FUNCTIONS AND PROPERTIES OF BASIC PDP-1 LISP
atom
car returns the first item in the argument list.
cdr returns all but the first item in the argument list.
cond x y... successively evaluates predicates x, y, etc until
a true predicate is found; returns the value of
the predicate.
CONS x y.. returns the concatenation of its argument list.
eq x y returns true if x and y are the same, otherwise nil.
x and y can be atoms or numbers.
eval x evaluates a list and returns its value.
gensym returns a unique generated atom gnnnnnn.
greaterp x y returns true if x > y, otherwise nil.
go
list
loc x gives the machine register in which the atom
or list x begins; its value is the location.
logand x y... returns the logically and of the argument list.
logor x y... returns the logical or of the argument list.
minus x returns the one's complement of the argument.
null x returns t if the argument is nil or empty, otherwise t.
numberp x returns t if the argument is a number, otherwise nil.
plus x y... returns the sum of the argument list.
prin1 x prints the atom x without the extra space at the
end. Its value is nil.
print
prog
quote
quotient x y returns x divided by y.
read
return
rplaca
rplacd
sassoc
setq
stop x halts the computer with x in the accumulator.
terpri prints a carriage return.
times x y... returns the product of the argument list
xeq c a i executes the machine language instruction c, with a
in the accumulator and i in the in-out register; and
returns a value in the form of (a i P) where a is the
new value of the accumulator after execution, i is
the new value of the in-out register after execution,
and P is t if the instruction skipped, and nil if the
instruction did not skip.
Table 2
SUGGESTED TEST SEQUENCES
input response
----- --------
nil nil
(logand 6 7 3) 2
(logor 12 3 15) 17
The sources to PDP-1 LISP were published in their entirety in the book "The
Programming Language LISP: Its Operation and Applications" by Edmund C.
Berkeley and Daniel G. Bobrow, 1964. Gordon Greene typed the sources in by
hand, assembled them, and then published the assembly listing on the Internet.
The source used here results from a line by line comparison of the Internet
source with the published source. Corrections to the Internet source are
noted by /** in the comments field.