Hooligan 0 Report post Posted January 21, 2005 If you need a C compiler to compile a program in C for example, who made the C compiling program, and how? Does it work from an older programming language, or is there some neat programming trick that I'm missing here? It's a bit puzzling to me. Share this post Link to post Share on other sites
no9t9 0 Report post Posted January 21, 2005 compiler software is written in the most basic programming language. All your C/C++, Visual Basic, etc. are called HIGH LEVEL programming languages. The most basic programming language is a LOW LEVEL programming language called Assembly. This language is as close to machine language as it gets. The compiler basically translates high level programming languages into machine language.I've written some programs using assembly to program a processor to perform automated and controlled tasks. It's not that difficult but you have to control every aspect of the processor. Share this post Link to post Share on other sites
s243a 0 Report post Posted January 21, 2005 I doubt people still right compilers in assembler. I had a professor who wrote an asselber in Perl for a microprocessor that was unique to the engineering department. Perl was a could choice for righting a complier in because it excels at manipulating text. An assembler is nothing more then a look up table. C is such a primitive language that the mapping between c code and assembly is pretty obvious. Aside from the need to parse expressions a c compiler need not be much more then a look up table. The basic compiler is also probably pretty intuitive. The translation from some languages such as JAVA, lisp and prolog to assembly may not be so obvious. Lisp and prolog are considered AI languages and in JAVA the code is first translated into beta code which represents instructions on a virtual machine. The virtual machine does not match PC assembly but may match closely to some sun systems. I herd the spark systems assembly is based on the JAVA beta code. Share this post Link to post Share on other sites
dexter 0 Report post Posted January 21, 2005 compiler software is written in the most basic programming language. All your C/C++, Visual Basic, etc. are called HIGH LEVEL programming languages. The most basic programming language is a LOW LEVEL programming language called Assembly. This language is as close to machine language as it gets. The compiler basically translates high level programming languages into machine language. I've written some programs using assembly to program a processor to perform automated and controlled tasks. It's not that difficult but you have to control every aspect of the processor. 42171[/snapback] Right... but not really the answer... Actually, today's compilers are written in high-level languages. The orginal compilers, though, that was another matter. Before our first high-level languages, and before assembly... there was machine code. Machine code was used originally for programming, and it was all done via 0110101010... etc. Assembly language was then thought of, and using machine code, our first assemblers were written (an assembly translates assembly into machine code). Eventually, after using assembly for some time, a work on a new language, FORTRAN, began. And a compiler for this language was written in assembly (this took an incredible amount of time... several man-years of work, if I recall correctly). And as I understand, that compiler was used to write other, better compilers, and so on and so forth. So, even though this C compiler was not written in machine or assembly code, it still relies on the original compilers and assemblers for it's existance. That's the basic idea behind how it all works and came about. Share this post Link to post Share on other sites
no9t9 0 Report post Posted January 21, 2005 I believe I answered his question the way I had interpreted it.I'm assuming the guy was talking about the "chicken and egg" phenomenon regarding compilers. Just saying that they were made in assembly. Obviously today there are many more options. Share this post Link to post Share on other sites
dexter 0 Report post Posted January 21, 2005 Ah, I see what you were getting at... it was just the use of present tense in relation to writing compilers in assembly that bothered me... Share this post Link to post Share on other sites
alperuzi 0 Report post Posted January 22, 2005 compiler software is written in the most basic programming language. 42171[/snapback] That sentence throws you off. as no9t9 noted, compilers can be written in any language, no assembler is required. If you go to computer engineering in university, in 3rd or 4th year you take a course on how to specify software mathematically, and you can take a course on how to design and write compilers. They usually use Java or more often C for this purpose. Share this post Link to post Share on other sites
cse-icons 0 Report post Posted January 30, 2005 nowadays compilers are also written in Java or C and compiled. But earlier the compilers were written in assembly language. i.e, critical portions of compiler relating to parsing and converting to binary code would be written in assembly language as a basic functionality and then this would be used to develop the rest. As alperuzi said, the compiler design course in computer science relates to this and is very interesting. You can find material on this course online too. Go thru it, not that u would/would not understand it at the first go... but a little effort would make it worthwhile. Share this post Link to post Share on other sites
BoSZ 0 Report post Posted January 30, 2005 If you need a C compiler to compile a program in C for example, who made the C compiling program, and how? Does it work from an older programming language, or is there some neat programming trick that I'm missing here? It's a bit puzzling to me. 42160[/snapback] assembler take a toor of google with this query and you will get the answer Share this post Link to post Share on other sites
8bit 0 Report post Posted February 1, 2005 Delphi > Game Maker > Program Creator > program...So technically somone compiled a program in a program compiled in a compiler in a compiler...dude...that's just stupid Share this post Link to post Share on other sites
alperuzi 0 Report post Posted February 3, 2005 why is it stupid?if you wanna code in 1s and 0s, go right ahead... Share this post Link to post Share on other sites