Description
Updated Official Cranelift Tutorial
I personally came to Cranelift as an LLVM alternative because LLVM was giving me trouble specifically with linking errors on my windows machine. I had high hopes going into using Cranelift because it just worked with the very helpful cranelift-jit-demo. Although after this first success, there was a lot of frustration because the demo is now outdated especially the faerie
branch and there is basically no other tutorials out there for Cranelift besides this brainfuck compiler I found.
For me, a newbie to Cranelift, trying to incorporate a compiler for my programming language project was very frustrating. Especially trying to use the cranelift-object
module. Chat GPT and copilot where not very helpful either 😭. I really wanted it to work because I think Cranelift is such an awesome piece of software but I just couldn't seem to do it. That's why I think an up-to-date tutorial for Cranelift would be very beneficial for people like me trying to make a compiler without using LLVM. I imaging it would be similar to the Kaleidoscope tutorial that LLVM uses.
Alternatives
I understand that this would be a big undertaking. If this is too much for now, an updated toy demo would work well. Specifically, one that doesn't use the outdated faerie
module.
Suggestions
A very simple toy language similar to the cranelift-jit-demo would be very beneficial. Especially if it would be kept up-to-date with the latest versions of Cranelift. And if someone had extra time, incorporating multiple types. For me at least, part of the pain was trying to use the cranelift-object
module, so maybe incorporating that into the tutorial would be helpful.