IRC channel logs

2025-12-06.log

back to list of logs

<qbit>maybe a stupid question.. but in your more informed opinions, what is the most "bootstrapable" language that isn't C?
<matrix_bridge><gtker> I'm working on a basic Rust compiler in M1 assembly and in some ways it maps better to the assembly since it "isize"/"usize" are just register sized instead of relying on "int" being able to be practically any size. There's also a lot more features that allow you to implement compiler built-ins that still function in the normal language like type deduced generics
<janus>since there is an association between the bootstrappable project and guix, i thought guile must be a reasonably bootstrappable language, is that right?
<matrix_bridge><Andrius Štikonas> janus: guile is hard to bootstrap
<matrix_bridge><Andrius Štikonas> At least if you want to rwbuild pregenerated filea
<matrix_bridge><Andrius Štikonas> https://github.com/schierlm/guile-psyntax-bootstrapping
<matrix_bridge><Andrius Štikonas> And it also has both C and C++ as dependencies
<matrix_bridge><Andrius Štikonas> mes interpreter that can run some scheme is easy though
<lanodan>I'd put [lua, awk, shell, make] as easy to bootstrap when you already have a C compiler, and then Go as "okay" (recently needs a chain but it's rather short, although could get worse).
<lanodan>JS could probably be used too thanks to QuickJS, but then it has basically 0 standard system APIs, making it quite useless in practice.
<matrix_bridge><cosinusoidally> It can be trivial to get JS vms to call into system APIs. I added a primitive FFI to the mujs JS vm in about 10 lines https://github.com/cosinusoidally/tcc_simple/blob/master/experiments/mujs_min/main.c#L481-L496 (32 bit only, but it allows you to call into a lot of libc APIs).
<matrix_bridge><cosinusoidally> 15 lines rather
<matrix_bridge><cosinusoidally> I've done similar with the duktape JS vm. A similar approach would probably be possible with quickjs too.
<matrix_bridge><cosinusoidally> Incidentally I found that it's possible to create a dialect of C that is simultaneously valid C/JS and AWK https://github.com/cosinusoidally/tcc_simple/tree/master/experiments/cjsawk . I found that to be fairly ok bootstrapping language. I'm able to use that to bootstrap all the way up to tcc (via an intermediate step of pnut).
<matrix_bridge><Andrius Štikonas> yeah, make is probably the easies to bootstrap with C
<matrix_bridge><Andrius Štikonas> just a few C files
<matrix_bridge><Andrius Štikonas> it's not good for writing further languages though, but at least you have build system
<matrix_bridge><Andrius Štikonas> awk is not hard either
<matrix_bridge><Andrius Štikonas> even older versions of perl are not too bad
<lanodan>Yeah, problem on the JS bit isn't writing stuff like FFI but more that QuickJS/Node/… do not use the same API for system interfaces, making JS a base language that lacks an ecosystem.
<lanodan>Compare with like how lua, C (POSIX or even pure ISO), … have system interfaces defined.
<matrix_bridge><cosinusoidally> I also added the same FFI to nodejs https://github.com/cosinusoidally/mishmashvm/blob/master/tests/nodejs/binding.c . Mozilla Spidermonkey has a built in ffi (jsctypes). I was able to polyfill the same JS ffi across multiple VMs and then access C APIs in the same way across all the VMs. Plus for bootstrapping not much is needed, just open/read/write/close .
<matrix_bridge><cosinusoidally> Maybe it would be better if interfaces were defined, but I wouldn't trust any of the JS/HTML standards bodies to do a decent job.