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


 
Thread Tools Search this Thread
Top Forums Programming How Can a Machine Reads a Compiler Since A Compiler is Written in Text! Not Binaries?
# 1  
Old 11-12-2008
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...
# 2  
Old 11-12-2008
The compiler is a binary program not ASCII text...maybe you mean how do you compile a compiler.
# 3  
Old 11-12-2008
I believe B, C's precursor language, was written in raw assembly language. Then they wrote a C compiler in B.
# 4  
Old 11-12-2008
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 :-/

Last edited by f.ben.isaac; 11-12-2008 at 07:03 PM..
# 5  
Old 11-13-2008
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.
# 6  
Old 11-13-2008
Quote:
Originally Posted by f.ben.isaac
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 :-/
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.
# 7  
Old 11-13-2008
Quote:
Originally Posted by jim mcnamara
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.

>>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
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Programming

C compiler to build Sparc/Solaris binaries on Linux

Just that the Subject says. I am looking for a C compiler for Linux x86 that will allow me to compile a C source code file and the resulting binary will be able to run on a Sparc running Solaris. Thanks. (2 Replies)
Discussion started by: lyonsd
2 Replies
Login or Register to Ask a Question