"Hello world" in Bismuth
This is the third in a series of posts about a virtual machine I’m developing as a hobby project called Bismuth. I’ve talked a lot about Bismuth, mostly on social media, but I don’t think I’ve done a good job at communicating how you go from some code to a program in this VM. In this post I aim to rectify that by walking you through the entire life cycle of a hello world Bismuth program, from the highest level to the lowest.
let hello = data_utf8("Hello world!\n");
func main() i32 {
// system call 0x10 is the PrintStr system call
sys(0x10, hello, 0, sizeof(hello));
return 0;
}
This code will be converted to the VM’s intermediate representation, which can then be transpiled to C, or compiled to a binary version of the IR, which the VM ingests and turns into bytecode and runs.
Continue reading...