Hacker News new | past | comments | ask | show | jobs | submit login

I could never do this. Because I would want a real Lisp. And that means things like GC.

Do you want to implement GC in 64k?

Also, I don't know compilers super well. And you have to know compilers to actually write an efficient lisp. I plan on learning that, at some point, but while I'm also writing an OS (or at least a monitor) for a Z80? Nope, forth it is.




Yes, my LISP(-like) did have a primitive GC.

The heap consisted of fixed 4-byte cons cells (2 byte car, 2 byte cdr). The cdr value was assumed to always be a pointer, which meant that since the cells were aligned at a 4-byte boundary, I had a few spare bits to implement mark-and-sweep GC and track which data type the car value was (number, atom, list or function).

Edit: I got curious and dug up the code. The entire GC code is less than 100 lines of Z80 assembler (admittedly some of the hairiest code in the interpreter, though)


Huh. Not so bad after all. Ah well.

The other problem becomes space efficiency, but that's not unsolvable.


> Do you want to implement GC in 64k?

Why not? The IBM 704 had around 18k and yet it was good enough for a full Lisp system.

Sometimes I think that people don't really grasp how constrained the computers using Lisp, Smalltalk and memory safe systems programming languages were and yet those systems were already there running, being used to doing actual work.

Somehow C's adoption has created a strange distortion of what those computers were actually capable of, in spite of their resource constraints.


Yeah, but the 704 was a 36-bit machine, and was otherwise well-suited to the task.

Still, I might give it a shot. Once I get the damn thing working, that is.


Those BASICs have GC in <= 64K. (Well, for just character strings.)

How about that IBM 704 from which we have the terms CAR and CDR?

"The 737 Magnetic Core Storage Unit had 4,096 36-bit words, the equivalent of 18,432 bytes and served as RAM."

[Wikipedia]


I didn't say it was impossible. But do you want to implement it?

Besides, the 704 had some helpful features the micros didn't. Also, it was a 36-bit machine. That's a massive advantage.


If I could relive the 80-s, that might be something I would work on.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: