How Can a Machine Reads a Compiler Since A Compiler is Written in Text! Not Binaries?

To make a programming language you need a compiler, so what was the first programming language and how was is created if you need the compiler first?

The compiler itself is considered as a high language comparing to the machine! since the compiler is not created in 1's and 0's...

Eventhough i have programmed before, this question confuses me everytime...

The compiler is a binary program not ASCII text...maybe you mean how do you compile a compiler.

I believe B, C's precursor language, was written in raw assembly language. Then they wrote a C compiler in B.

I still don't get it.....A compiler is binary, so its been executed, so what compiled the compiler! And the compiler compiler's in what language was written?

It is not a big deal, but i just find it hard to take it. Maybe its my problem :-/

You are asking the chicken & egg question - which comes first?
You can write a binary executable directly in hex, so very early assemblers (which are compilers) were written that way. There also were link editors as well. ld for example.

I like Corona's explanation. I think at one time I read that as well.

Most compilers are based on lex & yacc. Read about those.

The compiler's job is to produce assembly code given C source as input. The output of the compiler is fed to the assembler which translates all assembly code into machine code and finally the link editor sets up all the linkages to external functions.

Compiling the compiler is a process called bootstrapping similar to the way your machine boots up...more on it here.

>>You can write a binary executable directly in hex,

And HEX, so what translates these hexes to binaries for the compiler?
If a agree with you, writing in binary 1 & 0 will make machine understand what do you want to do! There has to be convertion between hexes to binaries and since hex is not binaries, what does the conversion! Machine does not giva a damn to anything else except if there is another binary written as a translator who translates hexes back to binary. Any idea?

I'm very new to this, i ask in a very dummy questions to know the basics - only overview, no technical stuff....

THANKS

I will be reading more about the various terms (bootstrapping, etc) you have posted here...

That's the job of the assembler. It converts hex strings to machine code in the instruction set of the mpu and ofcourse the separation of data and instructions.

Can you give an example of instruction set of the mpu? Does it look like:
ADD, JMP, etc? If yes, then ADD need to be translated too unless if it inserted directly as 110010 101001 (ADD #), something like that....

Ok assume, we wrote the code from the keyboard in binaries, so kept writing such as 101001 110110 10110100, refers to ADD AX, etc. Can my machine just grab this binaries without the help of any compiler?

I guess the only way to fully understand it, i have to take hardware, and compiler construction courses.

Anyway, I appreciate all of your help members! Well Said, Well Answered

Nothing. Hex is binary. No translation needed. It's difficult but not impossible to make rudimentary tools this way, and once you have those, you can use those rudimentary tools to build better ones.

Ok...I see. I have some misunderstandings. Your answer clarified it...

It's like being told to build the Eiffel Tower - and all you have is a simple charcoal forge and some hammers and metal saws. You build tools to make more powerful tools that you use to make really sophisticated tools. Then, finally, you can build the Eiffel Tower.