User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Software Developers' Lounge section within the Software Development category of DaniWeb, a massive community of 426,859 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,221 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Software Developers' Lounge advertiser: Programming Forums
Views: 2549 | Replies: 7
Reply
Join Date: Aug 2004
Posts: 212
Reputation: hexstar is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
hexstar hexstar is offline Offline
Posting Whiz in Training

Hmmm...how is the first compiler for a platform made?

  #1  
Dec 15th, 2005
Now here's a interesting question I've been pondering but haven't quite been able to solve...how is the first compiler for a platform made (e.g. new OS, processor, etc)?
The Digital Freeway, professional paid hosting starting at just $10 a month, 5GB disk space and 15GB bandwidth, we have free hosting too and all accounts are instantly activated
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2004
Posts: 6,330
Reputation: Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of Narue has much to be proud of 
Rep Power: 28
Solved Threads: 458
Super Moderator
Narue's Avatar
Narue Narue is offline Offline
Expert Meanie

Re: Hmmm...how is the first compiler for a platform made?

  #2  
Dec 15th, 2005
It's usually just a port of an existing compiler to the new system. It's possible to compile code on one machine for another, you know. That's called cross-compiling.
I'm a programmer. My attitude starts with arrogance, holds steady at condescension, and ends with hostility. Get used to it.
Reply With Quote  
Join Date: Aug 2004
Posts: 212
Reputation: hexstar is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
hexstar hexstar is offline Offline
Posting Whiz in Training

Re: Hmmm...how is the first compiler for a platform made?

  #3  
Dec 15th, 2005
huh? how is it possible to compile something for say, PPC on a Intel platform?
The Digital Freeway, professional paid hosting starting at just $10 a month, 5GB disk space and 15GB bandwidth, we have free hosting too and all accounts are instantly activated
Reply With Quote  
Join Date: Dec 2003
Location: Nashville, TN
Posts: 2,333
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Rep Power: 11
Solved Threads: 102
Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: Hmmm...how is the first compiler for a platform made?

  #4  
Dec 15th, 2005
It just "is"-- all compiling is is translating the higher level code to machine language. That, at heart, is just translation. Any machine can do that.
Alex Cavnar, aka alc6379
Reply With Quote  
Join Date: Aug 2004
Posts: 212
Reputation: hexstar is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
hexstar hexstar is offline Offline
Posting Whiz in Training

Re: Hmmm...how is the first compiler for a platform made?

  #5  
Dec 15th, 2005
That's true but last I checked the machine code for Intel and PPC platforms are different, as an example, one can't run linux apps compiled on a Intel computer and one can't run a linux app compiled on a PPC computer (a mac), as far as I know in order for a application to work on a certain processor it has to be compiled on that processor...of course there's obviously something you guys are trying to tell me that I'm just missing...hmmm...
The Digital Freeway, professional paid hosting starting at just $10 a month, 5GB disk space and 15GB bandwidth, we have free hosting too and all accounts are instantly activated
Reply With Quote  
Join Date: Dec 2003
Location: Nashville, TN
Posts: 2,333
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Rep Power: 11
Solved Threads: 102
Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: Hmmm...how is the first compiler for a platform made?

  #6  
Dec 16th, 2005
I think you've got your terminology mixed up. There's compiled on and compiled for. I can have code that's compiled on an AMD64 machine, but it's for a PPC machine.

Like I was mentioning earlier, it's just a matter of knowing how to translate the source code into the machine code that the target processor can read. The translation is a task that any machine can do, because it's just processing one form of input into another form of output. That's what computers do by nature.

Case in point: I've got an old Sparcstation with a 60mhz processor. If I need to compile something for it, rather than wait an hour for something to finish, I can compile it on my Athlon XP system in a fraction of the time. That's because I have appropriate cross-compilers for that platform.

Without getting into the specifics of machine-specific instruction code, the important thing to keep in mind is that one machine can compile code for another system quite easily, because all it compiling is, essentially, is taking one type of input (source code) and outputting it in another form (machine-specific code). There's logic applied to optimize the machine code, but even still, all we're doing is taking an input and translating it to a desired output format.
Alex Cavnar, aka alc6379
Reply With Quote  
Join Date: Aug 2004
Posts: 212
Reputation: hexstar is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
hexstar hexstar is offline Offline
Posting Whiz in Training

Re: Hmmm...how is the first compiler for a platform made?

  #7  
Dec 16th, 2005
Ah yeah that's true I suppose, just haven't come by any programs that do that as far as I know, thanks for your replies
The Digital Freeway, professional paid hosting starting at just $10 a month, 5GB disk space and 15GB bandwidth, we have free hosting too and all accounts are instantly activated
Reply With Quote  
Join Date: Dec 2003
Location: Nashville, TN
Posts: 2,333
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Rep Power: 11
Solved Threads: 102
Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: Hmmm...how is the first compiler for a platform made?

  #8  
Dec 16th, 2005
Originally Posted by hexstar
Ah yeah that's true I suppose, just haven't come by any programs that do that as far as I know, thanks for your replies

Glad to help-- if you're really interested in checking out cross-compiling in action, check out NetBSD. They wouldn't have been able to compile everything that they do if not for cross compiling-- it's simply not feasible to compile an entire native OS on and for an Amiga with a 40mhz 68040 processor, when you could do it on a dual Opteron system!
Alex Cavnar, aka alc6379
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Software Developers' Lounge Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Software Developers' Lounge Forum

All times are GMT -4. The time now is 9:57 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC