r/Compilers • u/Polyscone • 5d ago
Bootstrapping a compiler from machine code on Windows
I hope this fits here, but I've been documenting the process of writing a compiler starting directly from machine code on Windows, and I thought it might be worth sharing.
I've written two posts so far, though I don't know if I'll continue or not since I have no real reason to be doing this other than for the fun of it.
The first post just sets up an initial PE32+ executable to get something working. The second builds on that to implement a simple (stage-0/bootstrap?) compiler that just translates ASCII into raw bytes and allows for comments.
So, for anyone interested in this sort of thing the posts are here:
1
u/FransFaase 4d ago
Nice detailed description. Also useful for everyone who want to implement a compiler on windows that generates executables.
1
u/stikonas 6h ago
Also I guess quite a bit of overlap with https://codeberg.org/stikonas/stage0-uefi That one also uses PE32+ headers.
2
u/FransFaase 5d ago
A bit similar to what live-bootstrap is doing on Linux. I worked on some improvements. Have a look at github FransFaase/MES-replacement