8/23/00 (revised 5/28/10) Blake McBride blake@mcbride.name http://blake.mcbride.name This is an Interlisp interpreter originally written in Fortran but converted to C via the F2C Fortran to C converter. This release has been tested under Windows, Linux, and Mac and no longer requires F2C or its associated runtime library. I had used a slightly older version of this system back in the early 80's and found it very portable, reliable, functional, and fast enough. I learned Lisp with it and spent quite a bit of time with it back then. The author (back in 1983) is Mats Nordstrom from Uppsala, Sweden. I kept it around, ported it, enhanced some lisp code, and converted it into C. Sometime in the late 90's Mats was kind enough to give me a copy of the latest version he had (8/22/83). He also gave me permission to release it so long as I retained his credits. Interlisp is a dynamically scoped lisp system. It has no macro facility but supports LAMBDA (evaluates function arguments), NLAMBDA (doesn't evaluate its arguments), and variable number of arguments. Macros are not hard to simulate. The system contains no special optimizations such as P-code but has some good debugging and editing facilities. It also contains all the basics such as floating point numbers, arrays, and property lists. In all the time I've used it I have never found a bug in the base system (the part written in Fortran) and it has never crashed on me. The conversion steps I performed are as follows: 1. Convert the system to C and got it running via the F2C program. 2. Replace the Fortran calls to equivalent C calls to get rid of the need for the Fortran support library. 3. Enabled the use of command line arguments to control startup options. 4. Changed memory usage to allow runtime capacity specifications. 5. Changed some code to make it a little more portable. (The system should be highly portable in general though.) Since I have modified the converted C code you should not attempt to go from the Fortran code to C without loosing all of my changes. The Fortran code as-is will not run with F2C without a few tweaks. I have found that the system doesn't work when compiled for a 64 bit machine. I therefore changed the compile options to force 32 bit executables. The following files are included: README this file lispf41.f Fortran source - part 1 of 2 lispf42.f Fortran source - part 2 of 2 f4com.for the Fortran common declarations SYSATOMS system atoms needed when generating a new system Makefile makefile for Windows NT using NMAKE Makefile.unx makefile for linux or Mac Manual.txt User manual and Implementation guide *.l Lisp source files script.? scripts to build the image files f2c.h used by the .c files lisf4.orig the entire original system 1974_InterlispRefMan.pdf the Interlisp manual Pre-built executables are located under the Windows, Linux & Mac directories. You can find an Interlisp reference manual at: http://www.bitsavers.org/pdf/xerox/interlisp/1974_InterlispRefMan.pdf F2C (the Fortran to C converter) can be obtained at: http://netlib.bell-labs.com/netlib/master/index.html ftp://ftp.netlib.org/f2c ftp://netlib.bell-labs.com/netlib/f2c Building the system ------------------- Make lispf4.exe and the two image files by typing: Window/MSVC: nmake Linux or Mac: make -f Makefile.unx Running the system ------------------ In addition to loading lisp source files, lispf4 has the ability to save/load binary images of a running system. This enables you to load an entire pre-loaded image in a short time. Initially, if no image file is being loaded, the system requires the SYSATOMS file in order to builds its internal system. If an image file is being loaded the SYSATOMS file is not needed or used. Typically, one builds an image which contains the common lisp functions and uses that as the base system. The makefile builds two image files. BARE.IMG contains only SYSATOMS. BASIC.IMG contains SYSATOMS and most of the common lisp files. These common lisp files flesh out the system and would normally be used. The command line options are as follows: lispf4 [-cN] [-aN] [-sN] [-pN] [FILE.IMG] N = a number (no space between the option and N) c = car/cdr cells (default 100000) a = atoms (default 3000) s = stack space (default 1500) p = print names / strings / reals / arrays (default 5000) FILE.IMG = an image file name For example Lispf4 can be started in the following ways: lispf4 This causes a bare system to startup and SYSATOMS will be loaded. lispf4 BASIC.IMG This causes lispf4 to startup and load FILE.IMG. SYSATOMS is not used. lispf4 -c200000 BASIC.IMG This causes lispf4 to set the number of cons cells to 200000 and load BASIC.IMG. I'm not sure if you can mix different startup parameters with different image files. In other words, I don't think you can run the system with one configuration, save an image, and then load it with a lispf4 which was started with a different set of parameters. Someone should look into this. ---------------------------------------------------------------------- The raw system is case sensitive and all the built in functions are in upper case. BASIC.IMG has a lisp file loaded which sets an option to cause lispf4 to up shift all input so the system becomes case insensitive. To exit the system just type: (EXIT) Once the system is built you can save and load images as follows: (Note that this will only work if the proper lisp packages which perform these operations are loaded. These files are loaded in BASIC.IMG.) (SYSOUT "file.img") (SYSIN "file.img") You can also use the makefile lisp package (in MAKEF.L) to load and save groups of lisp functions in ASCII format as follows: (CURFILE name) ; names the group - all functions defined from that point are part of that named group (MAKEFILE name file T) ; saves all the functions associated with name to file (LOAD file) ; loads the file ---------------------------------------------------------------------- XCALL ----- Opening files: (XCALL 1 '(lfn file status form)) lfn = logical file number file = file name status = OLD or NEW form = FORMATTED or UNFORMATTED FORMATTED = ASCII files UNFORMATTED = binary or sysout files Closing files: (XCALL 2 lfn) ---------------------------------------------------------------------- Supported Interlisp Functions ----------------------------- primitive functions ------------------- CAR CDR CAR & CDR 3 deep CONS RPLACD RPLACA QUOTE COND SELECTQ PROG1 PROGN PROG GO RETURN SET SETQ SETQQ GETTOPVAL SETTOPVAL Function Definition ------------------- GETD PUTD PUTDQ GETDQ DEFINEQ SAVEDEF UNSAVEDEF EVAL BOUNDP APPLY EVALA RPT RPTQ DE (DL) DF (DN) List Manipulation ----------------- LIST APPEND NCONC NCONC1 TCONC LCONC COPY REVERSE DREVERSE SUBPAIR SUBST SUBLIS LAST NTH LENGTH DSORT ALPHORDER REMOVE DREMOVE Predicates and logical connectives ---------------------------------- ATOM LITATOM NUMBERP STRINGP LISTP NLISTP EQ NEQ NULL EQUAL AND OR MEMB MEMBER EVERY SOME ASSOC SASSOC PUTASSOC Property Lists -------------- GETPROPLIST SETPROPLIST GETPROP PUTPROP PUTPROPS ADDPROP REMPROP REMPROPLIST CHANGEPROP PROPNAMES SYSPROPS is a variable which contains a list of all the system properties. Math Functions -------------- ADD1 SUB1 ZEROP MINUSP PLUS MINUS DIFFERENCE TIMES QUOTIENT REMIANDER GREATERP LESSP GEQ LEQ MIN MAX ABS Print Names & Strings --------------------- PACK UNPACK NCHARS GENSYM STRINGP STREQUAL MKSTRING SUBSTRING CONCAT RPLSTRING MKATOM Map Functions ------------- FUNCTION MAP MAPC MAPLIST MAPCAR Terminal IO ----------- READ RATOM RSTRING READC PRIN1 PRIN2 PRINT SPACES TERPRI PRINTLEVEL PP PRINTPOS File IO ------- OPEN MAKEFILE READFILE LOAD CLOSE CURFILE PP IOTAB System ------- ROLLIN ROLLOUT SYSIN SYSOUT GCGAG RECLAIM Debugging --------- BREAK0 BREAK1 BREAK11 UNBREAK REBREAK TRACE UNTRACE VIRGINFN ADVISE UNADVISE READVISE ---------------------------------------------------------------------- Conditional (IF) package (IFDO.L) ------------------------ Requires MATCH.L This function is compatible with both the MIT version and the keyword version at UCB. simple summary: non-keyword use: (IF a b) ==> (COND (a b)) (IF a b c d e ...) ==> (COND (a b) (t c d e ...)) with keywords: (IF a THEN b) ==> (COND (a b)) (IF a THENRET) ==> (COND (a)) (IF a THEN b c d e) ==> (COND (a b c d e)) (IF a THEN b c ELSE d) ==> (COND (a b c) (t d)) (IF a THEN b c ELSEIF d THENRET ELSE g) ==> (COND (a b c) (d) (t g)) In the syntax description below, optional parts are surrounded by [ and ], + means one or more instances. | means 'or' is an lisp expression which isn't a keyword The keywords are: THEN, THENRET, ELSE, ELSEIF. is also a lisp expression which isn't a keyword. ::= | ::= (IF ) | (IF ) ::= (IF [ ] ) ::= THEN + | THENRET ::= ELSE + | ELSEIF [ ] ---------------------------------------------------------------------- DO WHILE/UNTIL Package (IFDO.L) ---------------------- Requires MATCH.L (DO WHILE expr