Arc Forumnew | comments | leaders | submitlogin
Glimmerings of a new Lisp atop x86 machine code and a Linux kernel (
2 points by akkartik 396 days ago | 4 comments

2 points by jsgrahamus 394 days ago | link

What is this exactly?


1 point by akkartik 394 days ago | link

I built an Arc-inspired toy Lisp interpreter like, oh, 5 years ago: (Source code:

But the experience frustrated me. It was hard for me to understand all the software under me as I provided abstractions above me.

So I spent the last 5 years gradually eliminating all the layers of abstraction that add complexity to my Lisp interpreter. The path passed through one other language for teaching programming: The sources for it are archived at (there was an earlier prototype in Arc at

At this point I have a very simple syntax for programming pretty much directly in machine code: It can be translated to an ELF binary for Linux using about 250KB of static x86 instructions (80% of which are unit tests, and much else of which is duplicated because I built the translator in multiple passes that run in a shell pipeline:

    $ cat examples/ex1.subx |./tests |./dquotes |./assort |./pack |./survey |./hex > a.elf

The nice thing about the resulting ELF binaries is that they can be run directly on a Linux kernel with no other dependencies. Not even libc.

There's a script in the repo called `gen_iso` that can take a list of .subx files, translate them into an ELF binary and package up the ELF binary with just a Linux kernel into a bootable disk image. You can then boot this image either in Qemu or on a cloud service like Linode (

This is what I have so far.

By contrast, the screenshot is quite fake. It's just a program that reads a line of text from the keyboard and prints it out to the screen. You can see it running on an emulated computer in Qemu that has nothing but a Linux kernel.

But I'm going to build up from that core into a high-level language. Maybe an Arc-inspired Lisp. Not a toy this time around.

Just give me 5 more years :D

To reiterate the main project link: Should hopefully be pretty easy to get running on Mac or Linux. (Though you're mostly on Windows, right jsgrahamus? I'm really sorry I still don't know Windows well enough to support it :( )


2 points by jsgrahamus 393 days ago | link

Thanks for this. I maintain Linux Virtual Boxes.


1 point by akkartik 393 days ago | link

Great! Yeah, I'd love to hear how you fare following the examples in the Readme.

The examples involving gen_iso take a while to run, which may be even greater atop VirtualBox. I'd recommend skipping those for now, particularly the very first one at the top of the Readme.