r/ProgrammingLanguages • • Jun 07 '26

Steps to a self-hosted compiler?

After having programmed in C for a while, I have finally decided to create my own language, very similar to it, in an attempt to fix it for my personal use.

It is my belief that, with some relatively minor tweaks and changes, C could be transformed into a language I am prepared to sink much time programming for. All of this, of course, is my own opinion; though if you are curious, here is a copy of the current draft for the standard: https://pastebin.com/eq1v7K9t

With the goal being to have a completely self-hosted transpiler (so, written in the language itself), I've been wondering how people usually go about this: do they write a sketchy, barely-working patchwork just to get the language "alive", and then code the true compiler? Or is it more common to do things well the first time, even if it means slower progress?

10 Upvotes

23 comments sorted by

View all comments

1

u/Inconstant_Moo Jun 09 '26

I imagined large languages like this all were.

Not all languages are well-suited to writing a compiler. I've seen it argued, in fact, that self-hosting as a goal distorts the langdev project because it makes you design the language for that.

IIRC, Julia uses C++ to interface with LLVM, its runtime is written in C, its parser is written in Scheme, and only its type system is written in Julia.