From: blp01 AT uow DOT edu DOT au (Brett Porter) Newsgroups: comp.os.msdos.djgpp Subject: Writing a simple compiler Date: Sun, 05 Jul 1998 03:03:04 GMT Organization: University of Wollongong, NSW, Australia. Lines: 23 Message-ID: <359eebbc.5439034@news.uow.edu.au> Reply-To: blp01 AT uow DOT edu DOT au NNTP-Posting-Host: ceast15.uow.edu.au To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hi, this ones for the compiler gurus. I'm writing a simple compiler based on a C-like language. Everythings doing alright as far as using Flex and Bison to parse the input. But now I've got to generating code and stumbled, mainly in the area of reducing expressions - as far as wanting to reduce 2*2 to 4 but generate code for 2*var. Anyone that could simply explain how to do this in Bison/Yacc I'd appreciate it, or a decent website/book on compilers that is relatively simple and straightforward. I've tried the GCC source, but I can't seem to get the big picture when it comes to looking over c-parse.y Thanks all, please reply by email as well if possible. Cheers, Brett --------------------------------------------------- Brett Porter http://members.xoom.com/brett_porter "I always like to do a first draft before being spontaneous." -- The Sandman ---------------------------------------------------