Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!nerds-end From: torbenm@diku.dk (Torben Ægidius Mogensen) Newsgroups: comp.compilers Subject: Re: Need an interesting topic for an undergraduate project on Compilers Date: Wed, 31 Aug 2011 11:15:31 +0200 Organization: SunSITE.dk - Supporting Open source Lines: 35 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <11-08-032@comp.compilers> References: <11-08-006@comp.compilers> <11-08-007@comp.compilers> <11-08-029@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: gal.iecc.com 1314797600 45913 64.57.183.58 (31 Aug 2011 13:33:20 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Wed, 31 Aug 2011 13:33:20 +0000 (UTC) Keywords: translator, C Posted-Date: 31 Aug 2011 09:33:20 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: x330-a1.tempe.blueboxinc.net comp.compilers:249 jgk@panix.com (Joe keane) writes: > Volker Birk writes: >>If you want to compile a programming language to assembler code > > I'm not sure why anyone would want to do this; if you have another > language you can convert it to C code, and concentrate on what you are > doing. If you find that the C->assembly step can be improved that is > also useful. C is not always well suited as a target language for a compiler (even though it is often used for this purpose). For example: - Standard C does not support indirect jumps. - Few C compilers support tail-call optimisation. - C does not support multiple return values from a function call. - Exceptions are not supported and are difficult to implement efficiently and portably. - Finding the root set for tracing garbage collectors is not easy. - Multi-word integer arithmetic is not supported, even though hardware often does. - A lot of C behaviour is defined as implementation dependent, so you can not be sure your code works the same on all machines/compilers. So there can be plenty of reasons to compile all the way to assembly code. Or use something like LLVM as target. Torben