Do you write the first compiler in another programming language? And the fully rewrite the compiler once the first compiler is mature enough to produce reliable builds, compile the new compiler on that first compiler, in order to have a compiler that is written in the same language as the one it’s compiling?

If this is the case, and this might be a stupid question, why would want to? You’ll essentially be throwing away potentially years of work on that first compiler just to have a circularly compiling programming language? What benefits could this have to make the extra effort worth it?

  • Ephera
    link
    fedilink
    12 years ago

    Yeah, there’s no way around writing it in a different language first (or by manually typing out the 0s and 1s), because you need an executable program to do the compiling.

    As far as I’m aware, the main benefit is ‘dogfooding’, i.e. actually using the language that you’re creating, in at least one larger project.

    Another big advantage is that people who would consider contributing to your compiler are most likely to know the programming language that they’re trying to compile, not some random other language.