Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think that very much depends on the Lisp in question. Even if you want a Scheme style Lisp which really needs some form of GC, you can implement a very rudimentary one using bump allocation. Basically just allocate memory by bumping the stack pointer and clear out everything at specific boundaries (i.e. you have some memory that is fixed at startup with the interpreter, basic functions, and constants but after that have well defined points where you clear out everything).

If you want something closer to assembly, you can just use a normal Lisp and have the Lisp compile itself to an assembly program, but with the benefit of things like variable names whatever other abstractions you can come up with. This approach is taken by Fairlylog[1] which is implemented in Racket but produces Verilog. You are basically writing a new language which compiles to assembly, but with the benefit of better tooling. Racket gives you the benefit of things like syntax-parse for writing the parser in a way that gives good error messages and more flexibility than a parser generator.

[1]: https://pkgs.racket-lang.org/package/Fairylog



> just allocate memory by bumping the stack pointer and clear out everything at specific boundaries

You've described region-based memory management, also known as arena allocation. [0] This can indeed work nicely in short-lived applications like missile-guidance and even serious compilers. [1] It's not real garbage collection though.

[0] https://en.wikipedia.org/wiki/Region-based_memory_management

[1] https://web.archive.org/web/20190126213344/https://www.drdob...




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: