Compiler Building

Where can I find the best ONLINE resources for building compilers?
I am not interested in Lex, Yacc company. I need to build a small C compiler by hand from the beginning to the end.
God bless you,
Who is Participating?
abdijConnect With a Mentor Commented:
  On what platform do you want to develop?

Whatever be it Hope this helps

Tools for Compiler Writing:

1. Compiler Writing Made Easy by Charles G. Petersen 


7.  -  10/29/1999  
All the best,
If any thing else comes along i will pass it to you.

gregclauAuthor Commented:
Main emphasis on building the Lexical Analizer and the Parser
Why online only?  Are you too cheap or lazy to read/buy a book?

The best resource I've ever read is a book by James Hendrix about his SmallC compiler for the X86 processor.  I followed a series of articles in DDJ in the early '90s.  It included a great description of how the thing works and had full source code to the compiler that could compile itself.

I'm not going to bother digging up any more information on it since you want ONLINE only but I thought I'd mention it...
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

jhance, not all people are as rich as you are... im sorry i had to say that, but that's just the way it is!
not even rich with points, it seems :-)  20 points for how to build a compiler !
not even rich with points, it seems :-)  20 points for how to build a compiler !  (BTW, the answer *is* to use Lex/Yacc).

Did you try a search engine? "Compiler Writing" brought a bunch of hits, even on a search of page titles only. As did "compiler building".  O.K, a bunch of them are book reviews, so you can throw them out. It seems that you want us to wade through the search engine hots for you, for a measly 20 points.

Btw, that came over as a nasty dig at viktomet (isn't it always the way in print, rather than in person)?). I'd say that if you are capable of writing a compiler, then you're capable of getting a programming job & then shelling out 20 or 30 bucks for a book (or skip a few smokes or drinks; life's about compromises).

>jhance, not all people are as rich as
>you are... im sorry i had to say that,
>but that's just the way it is!

While it may be true that not all people are as rich as I am, I'm not proposing a major expenditure either.  Even the most expensive programming books are US$50-$60 and if even that is prohibitive, virtually all such book are available absolutely FREE at many public libraries!!
60 bucks is quiet a bit for me... yes, library is a good idea but they dont have all the books and are not up to date.. new books are brought an year or more after the release of the book so you're never up to date (usually)...

graham, stop being greedy and try to help out the individual...

gregclau, why dont you try out

i think they have a tutorial on how to build a simple compiler (but the tutorial is for pascal programmers.. so if you know pascal you'll be on your way to building your own compiler)...

who's being greedy? I don't want/need any more points. It's just that when some college kid asks us to do his homework, we ask to see what code he's already written. I'd just like you to say "I've tried all search engines & trawled UseNet and I found nothing" (which I doubt would be true).  *Have* you tried UseNet -  ?

Just to show that I'm a nice guy, I''ll see what I can find, but will refuse any points.
No need to buy a book, all the info is on line. The easiest way to accomplish this task is to use Lex/Yacc as graham_h pointed out, unless you are just hard core and want to write your own state machine.

> library is a good idea but they
> dont have all the books and are
> not up to date..

Up to date really doesn't matter in this space - compiler theory that is not proprietary hasn't changed much, if at all, in the past 20 years or so.

In my mind, the very best book I've seen is "A Compiler Generator" by McKeeman, Horning and Wortman - Prentice Hall. (Pretty darned old, too).  I know this isn't a net resource, but it is something you are likely to find in the library.

Now they are hawking an old mainframe compiler generating program, *BUT* before they get to that, they go through, step by step, what you need to do to write a compiler.  Reading the first few chapters and doing the exercises will allow you to attack your small C compiler with confidence.
All Courses

From novice to tech pro — start learning today.