gjcarrette / siod

19 stars 3 forks source link

Is the source for the original Scheme In One Defun available anywhere? #1

Open johnwcowan opened 4 years ago

johnwcowan commented 4 years ago

I mean the one you wrote to test the Lisp Machine microcode compiler. I'd like to read it and learn from it.

Thanks.

gjcarrette commented 4 years ago

The first one I actually wrote for MIT NIL as in one DEFUN with PROG and GOTO, following course notes that ended up as chapter-9 in the first edition of Structure and Interpretation of Computer Programs. At that time the new MIT Course 6.001 was running off an interpreter that Hal Ableson had written in Maclisp and which was running on the EE Department TOPS-20 machine, to which I had contributed a shared-code-segment loader mechanism for Maclisp that I got from Yale, and modified the I/O settings from buffered line-at-a-time to single-character with a rubout handler (a primitive line editor that let you use the backspace or rubout key to correct and retype characters and terminate expressions with close paren or space without typing enter/return, because the underlying maclisp READ function was operating on the input stream, which was a user-defined stream, where a rubout operation with THROW out of the READ. Many interactive UI tools use this technique today, calling the parser/compiler again and again as you edit a program).

This was before MIT C-Scheme.

The source to this might be on some old ITS tapes and emulated systems now running.

But really I would recommend reading the relevant sections of the SICP book, and MIT Scheme-79 Chip. And of course the CADR MEMO.

This SIOD has the essential trick in it, which is that the interpreter is able to return to get an eval from the caller, when it might otherwise descend in the tail recursive position and blow tail recursion. The CADR had bit in the instruction giving the destination of the value of the operation, hence CALL D-RETURN was establishing a tail recursive call frame.

In a true Scheme in one DEFUN you would have a GOTO instead. Well, all GOTO. Unlike the Siod leval function that does both regular C function calls and uses goto.

Well, I've assigned you a lot reading here. When you are on your way you will be able to write your own Scheme in One Defun.

But the original source may turn up, I'll be on the lookout for it.

Oh, one more thing about that original SIOD, and it has yet another Yale connection.

There was a project at LMI see also Lisp Machine to build a machine called the K-MACHINE.

I thought I could contribute to accelerating the time-to-first-boot of a read-eval-print loop for the machine, the cold-load level, by allowing the hardware people to write the low-level code in Scheme, by changing the instruction set back-end of a production quality scheme compiler, Orbit: An Optimizing Compiler for Scheme. The source to the Orbit compiler was of course in Scheme dialect T. The Scheme in one DEFUN (SIOD) could run T at a reasonable performance even without being micro-compiled, although some other scheme interpreter might have also been used.

This message has a lot of links in it. I have not included links to papers that mention rubout handler, K-MACHINE, or the source to the CADR Microcode and Runtime UNLAMBDA, but you can find these using google.

johnwcowan commented 4 years ago

Thanks for all this very helpful commentary! I am something of a historian of implementations, as I find that good ideas in system A that were dismissed as useless for system B are very useful in modern system C now that so many constraints have changed.

johnwcowan commented 4 years ago

But as for writing my own SIODefun, it is a good thing for a historian to write a book, but usually considered bad for him to write a primary document. That is a different role, that of the re-enactor, which I have also played from time to time.

phensley commented 3 years ago

For historical interest I was able to locate some old versions of SIOD, the oldest being v1.4 uploaded Dec 1989: https://groups.csail.mit.edu/mac/ftpdir/siod/

phensley commented 3 years ago

I've captured several old versions of SIOD here https://github.com/phensley/siod-history, the current oldest being v1.3 from May 1988.