Live data from Hacker News

Writing a Lisp: Explicit Stack and Stacktraces

reinvanderwoerd.nl

11–12 of 12 posts

Re: Writing a Lisp: Explicit Stack and Stacktraces

#11
post #10
post #4

I feel like writing a LISP in a gc'ed language is taking away most of the fun of it. I wrote one in C (without a conservative garbage collector) and the most interesting aspect was what had to be done to allow garbage collection. Garbage collection can run inside nearly all subroutines. So any temporary references stored outside of the heap need to be kept track of at all times. If gc occurs you have to able to walk…

The irony of implementing Lisp in assembly is that, almost for free (sorry about that), you get precise, convenient control of the memory situation. Just put the gc root exclusively in registers. I wrote a Lisp interpreter in assembly that dedicates 4-5 registers for the current expression, eval environment, and so on. The mark-sweep collector starts from these registers. https://github.com/marcpaq/arpilisp

Cool project. It's much clearer than I would have thought in asm. The inline documentation is good.

Re: Writing a Lisp: Explicit Stack and Stacktraces

#12
post #10
post #4

I feel like writing a LISP in a gc'ed language is taking away most of the fun of it. I wrote one in C (without a conservative garbage collector) and the most interesting aspect was what had to be done to allow garbage collection. Garbage collection can run inside nearly all subroutines. So any temporary references stored outside of the heap need to be kept track of at all times. If gc occurs you have to able to walk…

The irony of implementing Lisp in assembly is that, almost for free (sorry about that), you get precise, convenient control of the memory situation. Just put the gc root exclusively in registers. I wrote a Lisp interpreter in assembly that dedicates 4-5 registers for the current expression, eval environment, and so on. The mark-sweep collector starts from these registers. https://github.com/marcpaq/arpilisp

No irony there. You need precise control over the machine to implement a paradigm accurately from the ground up. It's hard to do that using someone else's paradigm, living with their choices of what aspects of the machine are still revealed and which are hidden.
Post reply on HN