this post was submitted on 07 Jul 2026
20 points (100.0% liked)

Programming

27627 readers
218 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS
 

Self-host your compiler, you cowards!

Several times this year, I've read about new systems programming languages, usually created with robotic help. That's great! New languages expand how we think about programming. I've noticed their compilers are almost always written in Rust.

Rust is a fine systems programming language in its own right, but a systems programming language, the kind of language meant for writing things like compilers, ought to be used for its own compiler before it's used for any other serious work.

I'm kidding about the cowards part of course. I'm sure all language designers are brave and kind, even if some look like serial killers.

@programming

@programming@programming.dev

#programming #languagedesign #rust #compilers

you are viewing a single comment's thread
view the rest of the comments
[โ€“] Miaou@jlai.lu 5 points 1 day ago (1 children)

Rustc is built atop llvm, and there's been a lot of work on the GCC front-end. Your comment makes the situation sound worse than it is

[โ€“] calcopiritus@lemmy.world 1 points 16 hours ago* (last edited 16 hours ago)

I don't see how LLVM helps with bootstrapping.

Yes, it helps with supporting newer platforms, since LLVM is a big project and will probably have support for the new platforms relatively fast.

But as long as any part of the whole process is in rust, it means that you need a rust compiler to build the rust compiler, thus needing to solve the bootstrapping problem.

Of course, every compiler has this issue (even if not self-hosted, you still have to bootstrap the compiler of the language your language is written in).

The only solution for this is to have a compiler-chain where the first level is a simple compiler that can be relatively easily written in the assembly language of the new platform.

EDIT: or of course I could've read any other comment. Of course you can use one of the intermediate representations that are portable to build the first compiler. In which case you don't need a rust compiler, just need LLVM. Makes sense then.