From Assembly to OS: Building a C Compiler from Scratch

Tumble Forth – from assembly to OS with C compiler

Virgil Dupras, creator of Collapse OS and Dusk OS, launches a series guiding web developers into low-level programming. Starting from bare metal on the PC, readers build a Forth, then Dusk OS, and finally a partial C compiler—all from scratch. The series targets programmers new to low-level work, with each episode including a corny joke.

We peek in disgust in the abyss of modern software complexity and escape this dystopia by tumbling down the rabbit hole of low level development.
  1. fjfaase

    For the C compiler that I developed to replace the GNU Mes compiler in the live-bootstrap project, I also used a Forth like language that uses two stack. One stack for parameters and return values and one for the return addresses and local variables. The Forth like language is transpiled in assembly and through some steps made into an ELF file. The targets are: x86, x86_46, and arm64. Work on supporting riscv64 has started, but is currently on hold due to other responsibilities. If there is anyone willing to complete it, I do have some small funds as a bonus.

  2. zovirl

    > An alternate way to go about this is to sidestep that complexity entirely and build your own OS.

    > We'll go bare metal and then build an operating system of our own, with a C compiler of our own. It's simpler this way.

    I love the audacity of those statements. And I appreciate this sort of approach which says "let's implement the simplest possible version of _______ to learn how it is done."

  3. drivers99

    Oh yeah, this is right up my alley. I've been thinking about making a Forth on bare metal for a while (made a Forth interpreter in C last summer, and a tiny amount of testing stack manipulation in hand-assembled machine language on a C64U), and the thought I (coincidentally) had moments before seeing this link was about making a boot sector on some floppies I just got for my 8088 IBM PC. I know that will only work for the Real Mode part but it might be fun to start there anyway. Edit: I knew about CollapseOS but didn’t realize this had been around too.

More from this day

2026-08-21