From: Bill Currie Newsgroups: comp.os.msdos.djgpp Subject: Re: Writing a simple compiler Date: Mon, 13 Jul 1998 18:39:59 +1200 Organization: NetLink Wellington, New Zealand. Lines: 25 Message-ID: <35A9ABBF.2E3ABA39@taniwha.tssc.co.nz> References: <359eebbc DOT 5439034 AT news DOT uow DOT edu DOT au> <35a720ea DOT 2211979 AT news DOT Austria DOT EU DOT net> <35a74609 DOT 2414510 AT news DOT uow DOT edu DOT au> NNTP-Posting-Host: nzlu02.tssc.co.nz Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Brett Porter wrote: > It was fantastic learning how to use lex and yacc but didn't do much > in terms of actions and code-generation: beyond the scope of the book > really. I think I've got it down now, using "Introduction to Compiling > Techniques" by JP Bennett. It uses Lex, Yacc and C to write a simple > compiler, with all the source in the back of the book. Mine is > slightly more complicated than the language they use, but it got me > going. We'll see... any other good books would be appreciated. "Compiler Design in C" by Allen I. Holub, Prentice Hall, ISBN 0-13-155151-5. IMHO, this is an excellent book on compilers and compiler-compilers (ie lex and yacc). It goes into the full nitty gritty of compiler operation right from lexical analysis to optimising the output (a little skimpy on the optimisation, but I didn't read that chapter fully), but presents the information in a reasonably understandable way (Lots and lots of examples). It has full source code to a version of lex, two parser generators (one yacc like) and a buggy C compiler (deliberate, one of the `assignments' is to fix it). You can by the source for somewhere in the vicinity of $60US (1992) or you can sit there and type it in for a month or two (I did:). Bill -- Leave others their otherness.