Eli5: If a compiler is a program that converts your code into binary form for the computer, unless my understanding is incorrect and it isn’t just a program, wouldn’t the compiler also need a compiler to run it since how do you run a program without a compiler?

1.06K views

Eli5: If a compiler is a program that converts your code into binary form for the computer, unless my understanding is incorrect and it isn’t just a program, wouldn’t the compiler also need a compiler to run it since how do you run a program without a compiler?

In: 360

25 Answers

Anonymous 0 Comments

The information you are looking for, is how was the first compiler created ? Well it was developed in binary, to translate code into binary

In the beginning, adding 3 and 5 together looks something like this 0101 1010 0000 0011 0000 0101. After the first compiler, we could write ADD 3, 5 and it will be translated into the binary string written above.

Now, the program that translates “ADD 3, 5” into “0101 1010 0000 0011 0000 0101” had to be written with 0s and 1s.

That program would be something like
“If the first character is A and the second is D and the third is D, output 0101 1010”
If a character is 1, output 0000 0001
If a character is 2, output 0000 0010

Of course this paragraph could be hundreds of segments of binary code, but it is achievable. And once you are able to write the addition (ADD), the substraction (SUB), division (DIV), multiplication (MUL), … You can then use this code to write a new compiler in code that translates code to binary, instead of using the compiler written in binary

You are viewing 1 out of 25 answers, click here to view all answers.