Chicken or the egg?
-
I think the java compiler was originally written in C and then rewritten in java. Apparently it was running too fast and showing the programs up :-D pseudonym67 Neural Dot Net Articles 1-11 Start Here Fuzzy Dot Net Articles 1-4 Start Here "Do you hide in Happy Hour?" Marillion Clutching At Straws
pseudonym67 wrote: Apparently it was running too fast and showing the programs up ROFLMAO. Chris Meech If you spin a Chinese person around, do they become dis-oriented? Why do people in this time period worry so much about time traveler's destroying their worldline when they have no problem doing it themselves every day? John Titor.
-
I once used a compiler from Bell Labs that took C++ syntax and converted it to C to run thru cc. SO my bet would be that the language constructs came before the compiler. I would be interested to know how namy of the modern compilers have, at their heart , a C compiler. Compilers are a real bear to write properly and I bet there is a lot of code carried over. Richard "The man that hath not music in himself and is not moved with concord of sweet sounds is fit for treasons, stratagems and spoils; Let no man trust him." Shakespeare
Visual C++ has two front ends,
c1.dll
andc1xx.dll
, responsible for parsing the source code into a common abstract representation (as in, common to both C and C++ code). The back end, which translates the abstract representation into actual executable code, is implemented inc2.dll
- I think this module actually includes two translators now, one to x86 machine code and another to MSIL; the representation between the two stages of the compiler is richer than MSIL, and is a development of the one from VC 6.0. When you specify link-time code generation with VC 7.x, the second stage isn't run bycl.exe
- the OBJ files contain the abstract representation.link.exe
usesc2.dll
to generate the code at link time. In theory, you could get VC to generate machine code for a different platform by replacingc2.dll
. However, the different platforms so far have had slight differences in intrinsics and large ones in__asm
orasm
blocks, so a new front end has also had to be produced. eMbedded Visual C++ 3.0 comes with five variants ofcl.exe
and its attendant DLLs -cl.exe
(x86),clarm.exe
(ARM),shcl.exe
(Hitachi SH3 and SH4),clmips.exe
(MIPS R4000 series) andclppc.exe
(PowerPC). -
Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;
If you are serious about finding out look for Dr. Grace Hopper. She died not too long ago. She worked for the Navy on some of the first computers. Here is a good start: Dr. Grace Hopper[^] A very interesting woman. I like her name. I tend to forget names easily but her name is a classic. Her accomplishments include: Creating the first compiler (in fact others thought this feat to be impossible) Creating the first computer language Coining the term BUG
-
keegan wrote: How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? It's a progressive thing... You start with an assembler built using machine code, then implement your language's commands in assembly to make a rudimentary compiler. Then you use your language to build more complex and functional compilers for languages you design. Still, the language has to be designed first before you can decide what your compiler needs to do. "Some people are like Slinkies... not really good for anything,
but you still can't help but smile when you see one
tumble down the stairs."These days, we'd use C rather than assembler. Indeed, many compilers are written to generate C, at least at first; the GNAT (Gnu NYU Ada Translator) compiler is an adapted GCC which translates Ada into C, then compiles the resulting C code. To port to a new platform, you create a cross-compiler: a compiler which runs on one processor, but generates code for another. Once you have your cross-compiler, you can compile your compiler for the new platform, creating a native compiler. IIRC, the IA-64 and AMD64 versions of Microsoft's
cl.exe
are cross-compilers: they are themselves x86 executables. -
If you are serious about finding out look for Dr. Grace Hopper. She died not too long ago. She worked for the Navy on some of the first computers. Here is a good start: Dr. Grace Hopper[^] A very interesting woman. I like her name. I tend to forget names easily but her name is a classic. Her accomplishments include: Creating the first compiler (in fact others thought this feat to be impossible) Creating the first computer language Coining the term BUG
-
Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;
keegan wrote: Which came first, the language, or the compiler? Neither. First, people "programmed" by moving wires around to hardcode simple algorithms. Then, von Neumann had the brilliant idea around 1958 that hardware should be fixed but flexible, supporting "programs" that were a collection of subroutines (the idea of re-use is born!). But the programs were still written in machine codes very closely tied to the hardware. Assemblers were a step toward symbolic representation. Languages, like Cobol and Fortran were written to unify diverse and constantly changing machine languages and specialized in business and scientific processing. Thus the concept of the compiler was born, I believe. However, the first language that had a formal syntax (one that could be specified by a lexical parser) came a bit later (dang, I can't remember it's name right now!) and is the precursor for languages like C. As to your confusion, languages like Fortran were written first in assembly code. Marc Latest AAL Article My blog Join my forum!
-
Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;
The language definition must come first. The purpose of the compiler is to translate text which conforms to the language syntax into machine code which can be executed. Without knowing what the language syntax is, the compiler can not be written. A compiler can be written in the language it's compiling. It just can't be the first compiler for that language, since there is no tool at that point to turn the source code (for the compiler, in this case) into a running application. It's very rare these days to have to 'bootstrap' a compiler these days on native hardware. It's just too easy to develop the compiler on some other machine or under an existing environment, run it there, and generate code for the target environment.
Software Zen:
delete this;
-
If you are serious about finding out look for Dr. Grace Hopper. She died not too long ago. She worked for the Navy on some of the first computers. Here is a good start: Dr. Grace Hopper[^] A very interesting woman. I like her name. I tend to forget names easily but her name is a classic. Her accomplishments include: Creating the first compiler (in fact others thought this feat to be impossible) Creating the first computer language Coining the term BUG
I would have to disagree about Dr. Grace Hopper creating the first computer language. I would have to say it was Charles Babbage who created the first language (Machine language is also a computer language - someone had to design it!) when he designed his Analytical Engine. And the first programmer was Ada Augusta Byron, the Countess of Lovelace and daughter of Lord Byron. She wrote programs for Charles Babbage's Analytical Engine in the 19th Century. However, as funding ran out the engine was never built and the programs never tested. ...And it was the Egg that came first - it was not a chicken that laid it, but the egg hatched in to a chicken through the miracle of genetics and evolution.
-
Visual C++ has two front ends,
c1.dll
andc1xx.dll
, responsible for parsing the source code into a common abstract representation (as in, common to both C and C++ code). The back end, which translates the abstract representation into actual executable code, is implemented inc2.dll
- I think this module actually includes two translators now, one to x86 machine code and another to MSIL; the representation between the two stages of the compiler is richer than MSIL, and is a development of the one from VC 6.0. When you specify link-time code generation with VC 7.x, the second stage isn't run bycl.exe
- the OBJ files contain the abstract representation.link.exe
usesc2.dll
to generate the code at link time. In theory, you could get VC to generate machine code for a different platform by replacingc2.dll
. However, the different platforms so far have had slight differences in intrinsics and large ones in__asm
orasm
blocks, so a new front end has also had to be produced. eMbedded Visual C++ 3.0 comes with five variants ofcl.exe
and its attendant DLLs -cl.exe
(x86),clarm.exe
(ARM),shcl.exe
(Hitachi SH3 and SH4),clmips.exe
(MIPS R4000 series) andclppc.exe
(PowerPC).Sounds pretty much lika any modern cross compiling compiler :) Did you ever read the Dragon Book? It's nice to see that some theories have actually been implemented.. :-D -- You still have your old friend Zoidberg. You all have Zoidberg!
-
I think the java compiler was originally written in C and then rewritten in java. Apparently it was running too fast and showing the programs up :-D pseudonym67 Neural Dot Net Articles 1-11 Start Here Fuzzy Dot Net Articles 1-4 Start Here "Do you hide in Happy Hour?" Marillion Clutching At Straws
:-D Ever tried jikes? The IBM java compiler? It's written in C++ and it SCREAMS! :) -- You still have your old friend Zoidberg. You all have Zoidberg!
-
If you are serious about finding out look for Dr. Grace Hopper. She died not too long ago. She worked for the Navy on some of the first computers. Here is a good start: Dr. Grace Hopper[^] A very interesting woman. I like her name. I tend to forget names easily but her name is a classic. Her accomplishments include: Creating the first compiler (in fact others thought this feat to be impossible) Creating the first computer language Coining the term BUG
It would be interesting to discuss modern programming languages with her. Too bad she's passed away. :( -- You still have your old friend Zoidberg. You all have Zoidberg!
-
I would have to disagree about Dr. Grace Hopper creating the first computer language. I would have to say it was Charles Babbage who created the first language (Machine language is also a computer language - someone had to design it!) when he designed his Analytical Engine. And the first programmer was Ada Augusta Byron, the Countess of Lovelace and daughter of Lord Byron. She wrote programs for Charles Babbage's Analytical Engine in the 19th Century. However, as funding ran out the engine was never built and the programs never tested. ...And it was the Egg that came first - it was not a chicken that laid it, but the egg hatched in to a chicken through the miracle of genetics and evolution.
I don't know. An interesting argument, but from what I have just briefly read on Babbage, he created a machine to use geometrical proofs to interpret mathematical proofs. I suppose if you consider bicycle peddles a motor then the Analytical Engine is a computer. Hmmm.... :confused:
-
Sounds pretty much lika any modern cross compiling compiler :) Did you ever read the Dragon Book? It's nice to see that some theories have actually been implemented.. :-D -- You still have your old friend Zoidberg. You all have Zoidberg!
Jörgen Sigvardsson wrote: Did you ever read the Dragon Book? Mike borrowed my copy of it a long time ago, IIRC. I did get it back though (along with my copy of Modern Compiler Design which was also borrowed) :-) I think he read them more than I did :rolleyes: -- Ian Darling "The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
-
Ok, so this is a pretty common question, which came first, the chicken, or the egg? But, i have a twist. Which came first, the language, or the compiler? I've looked in my c++ books, and i searched google about it last night, but many of the answers i uncovered were rather vague. How can you write a compiler in a language to compile the language you wrote the compiler in? (bleh) its confusing to me, can someone explain this? :omg::eek: *.* cin >> knowledge;
Easy, what came first was the Assembler[^]. Back in the day programmers only programmed in assembly, they had squinty eyes and drank copious quantities of caffeinated beverages. They had names like Bill or John or Steve and you just knew by looking into their eyes that they were never going to lose their virginity. ;)
-
:-D Ever tried jikes? The IBM java compiler? It's written in C++ and it SCREAMS! :) -- You still have your old friend Zoidberg. You all have Zoidberg!
No I haven't tried it but then I only go anywhere near Java if it is required by work and they are into the oracle java stuff at the moment. pseudonym67 Neural Dot Net Articles 1-11 Start Here Fuzzy Dot Net Articles 1-4 Start Here "Do you hide in Happy Hour?" Marillion Clutching At Straws