Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!nerds-end From: glen herrmannsfeldt Newsgroups: comp.compilers Subject: Re: Good practical language and OS agnostic text? Date: Wed, 18 Apr 2012 22:43:10 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 35 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <12-04-028@comp.compilers> References: <12-04-019@comp.compilers> <12-04-024@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1334801410 95522 64.57.183.58 (19 Apr 2012 02:10:10 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Thu, 19 Apr 2012 02:10:10 +0000 (UTC) Keywords: books Posted-Date: 18 Apr 2012 22:10:10 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com X-Received-Bytes: 2576 Xref: csiph.com comp.compilers:571 Derek M. Jones wrote: > On 17/04/2012 22:28, compilers@is-not-my.name wrote: >> Guys, I'm having a bear of a time finding a good practical language >> and OS agnostic text on writing a compiler. I'm weak in math and not >> interested in the theoretical details. I want to understand the hows >> and whys of compiler writing. > I always recommend: > A Retargetable C Compiler: Design and Implementation > by David R. Hanson and Christopher W. Fraser So, that makes two (out of about five) of us. (My post comes later.) Much of the book is about code generation, which, it seems to me, is not described in as much detail in many other compiler books. Parsing theory is where much of the theory, and hard to understand mathematical descriptions, appear, but in the end (back end, in the case of compilers) it is about code generations. As far as languages to write compilers in, it is now usual (though maybe not 50 years ago) to describe parts of the compiler in a special purpose language. As previously noted, there are flex and bison to write the front end, though you usually need to know some C to use them. For compilers that generate code for more than one target, (at least gcc and lcc), the back end is usually described through a language easier for humans to understand. To me, the lcc code generator is much easier to understand than that of gcc. You should be able to write a description for a new target without knowing C, or much of parsing theory. You do need a good understanding of the instruction set for the target, though. -- glen