logoalt Hacker News

matheusmoreira11/07/20241 replyview on HN

I've been working on that language for a while now!

https://github.com/lone-lang/lone

It's a lisp interpreter with a built in system-call primitive. The plan is to implement everything else from inside the language. Completely freestanding, no libc needed. In the future I expect to be able to boot Linux directly into this thing.

Only major feature still needed for kernel support is a binary structure parser for the C structures. I already implemented and tested the primitives for it. I even added support for unaligned memory accesses.

Iteration is the only major language feature that's still missing. I'm working on implementing continuations in the interpreter so that I can have elegant Ruby style iteration. This is taking longer than expected.

This interpreter can make the Linux kernel load lisp modules before its code even runs. I invented a self-contained ELF loading system that allows embedding arbitrary data into a loadable ELF segment that the kernel automatically maps into memory. Then it's just a matter of reaching it via the auxiliary vector, The interpreter uses this to automatically run code, allowing it to become a freestanding lisp executable.

I wrote an article about how it works here:

https://www.matheusmoreira.com/articles/self-contained-lone-...


Replies

samatman11/08/2024

> I'm working on implementing continuations in the interpreter

You might find this paper (and everything else on the site) interesting and relevant.

https://okmij.org/ftp/continuations/ZFS/context-OS.pdf