this post was submitted on 25 Aug 2024
110 points (97.4% liked)

Rust

5771 readers
51 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] livingcoder@programming.dev 4 points 3 weeks ago (1 children)

Oh, okay. Thank you for clarifying. So doesn't that mean we should never have a compiler written in the same language that it compiles? Why would we ever choose to make the mistake of using the same language? Is it ever not a mistake?

It makes sense that if you're designing a language, you'd like the language you made and would want to use it. It's fine for compilers like that to exist, and even be the main one used, but ideally it shouldn't be the only compiler.

But there are technically ways to bootstrap a language without writing it in another language (other than a small core in assembly or something). You could design a tiny compiler that only handles a small subset of your language, then write a better compiler using only the features available in that subset. You can do this for several layers of compilers until you have the full language.