LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-14-2003, 06:09 AM   #1
Grim Reaper
Member
 
Registered: Apr 2002
Distribution: Gentoo 2006.0 AMD64
Posts: 399

Rep: Reputation: 30
I've always pondered this question...


Ok, so I've built a LFS system...but technically its not really from COMPLETE scratch...i wanna do something that you build from absolute scratch!! is that possible?

but thats not the question i've been pondering...the question is: how do you compile say, gcc, without a compiler??? hehe...so how do you compile a compiler (without one already installed, however they got it there..)...how did the first compiler get compiled, lol....just a little question...

so would it be possible to start from the absolute scratch?
 
Old 01-14-2003, 06:17 AM   #2
0x0001
Member
 
Registered: Sep 2002
Distribution: Slackware 8.1
Posts: 84

Rep: Reputation: 15
opcodes, opcode macroing -> assembler compiler. and so on.

The trick is that the first compiler was probably just a macro expander. From that on they got more and more complex.
I guess, I was not around at that time
 
Old 01-14-2003, 03:06 PM   #3
Grim Reaper
Member
 
Registered: Apr 2002
Distribution: Gentoo 2006.0 AMD64
Posts: 399

Original Poster
Rep: Reputation: 30
hehe...

anybody wanna add onto that?
 
Old 01-14-2003, 03:35 PM   #4
yngwin
Member
 
Registered: Dec 2002
Location: China
Distribution: Arch
Posts: 359

Rep: Reputation: 33
How to compile a compiler is a chicken-and-egg kind of problem. I've been pondering the same. I suppose if one were knowledgable enough, one could write a compiler in assembly...?
 
Old 01-14-2003, 03:49 PM   #5
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Grim, you could, in theory do this (with something like Assembly). I am just about as green as they come when it comes to coding, so I really don't even know the depth it would take to undertake such a project.

But for now, we are lucky enough to not have to, with the LFS project's way, or with just using a precompiled binary on a truly nekkid drive. Either way, it's something the average (and probably even the more advanced) user doesn't have to worry too much about.

If you wanted to undertake a project like that, I'd see about joining a mailing list:
http://www.gnu.org/software/gcc/
Or you might even find the actual answer to your question just pluggin around that site. Either way, I'm sure it will be a lot of work, and if you do decide to try it out, let us know how things go, some sort of progression thread.

Cool
 
Old 01-14-2003, 03:54 PM   #6
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
http://compilers.iecc.com/comparch/article/97-06-113

Just out of curiosity, I found some links and pages over at the link to gcc I posted in that last thread, I came upon the above link. I didn't read through it, however this person seems to have a similar idea as you

Cool
 
Old 01-14-2003, 06:50 PM   #7
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
gcc can compile itself before its installed. its
a minimal sort of compile, and you have to recompile
it later.
i remember something like
make bootstrap
or something like that
 
Old 01-14-2003, 07:49 PM   #8
Bert
Senior Member
 
Registered: Jul 2001
Location: 406292E 290755N
Distribution: GNU/Linux Slackware 8.1, Redhat 8.0, LFS 4.0
Posts: 1,004

Rep: Reputation: 46
Think about what a compiler actually has to do with a source code, then have a look at:

man yacc

Bert
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question, Apples Contribution to Open Source + MacOs file structure question Higgy3k Other *NIX 5 07-25-2005 04:23 AM
Not your regular GRUB question - just a short question for a fried MBR!! ziphem Linux - General 3 01-31-2005 01:51 PM
2 part question: Speeding up MDK9.1/GNOME question wardialer Linux - Newbie 6 10-14-2004 03:16 PM
login prompt question & kde scheme question JustinCoyan Slackware 2 06-09-2004 02:02 PM
RE: Suse 8.0 hardware question {newbie question, pls help} Radiouk Linux - Distributions 2 06-04-2002 12:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration