So I’ve already posted this question on Stack Overflow, but I wanted to ask it here as well, since I am not sure if they will simply say it is a duplicate (even though the other answers from other questions don’t answer what I asked in a way that helps me).
[https://stackoverflow.com/questions/78539284/in-bootstrapping-how-is-the-compiler-written-in-the-other-langauge-such-that-it](https://stackoverflow.com/questions/78539284/in-bootstrapping-how-is-the-compiler-written-in-the-other-langauge-such-that-it)
So I was wondering if there were direct examples people could give of how the bootstrap compiler is actually written such that it actually represents the language you want to write in another language, because my head can’t wrap itself around it and most sources are fairly vague and just assume you know how it is done.
Hell, maybe if people try and explain it in a metaphorical way and walk me through how the bootstrap compiler is written to represent language X in language Y, that might help too, since I am not a programmer, but this concept is stressing me out from knowing I don’t understand it.
In: Technology
Let me ask you this first: Why do you think the language the compiler is written in, is relevant?
You have a specification for what a piece of code should do in your language.
You have some target language, probably assembly.
You need to transform the first to the second. You’ll do it by hand at first, for the smallest pieces of code. Then eventually you have an exact plan for how a whole program is translated. And then you implement that exact description in some language. This is now a compiler.
Reasons for implementing the compiler in the same language is for other reasons. It sounds cool. They enjoy working with their new language. Compilers are unusual software so you find lots of bugs in the compiler while you build it.
Latest Answers