Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end From: "Rafael R. Sevilla" Newsgroups: comp.compilers Subject: Unit testing a compiler Date: Wed, 13 Mar 2013 11:50:30 +0800 Organization: Compilers Central Lines: 10 Sender: johnl@iecc.com Approved: comp.compilers@iecc.com Message-ID: <13-03-009@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: leila.iecc.com 1363147407 90614 64.57.183.58 (13 Mar 2013 04:03:27 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Wed, 13 Mar 2013 04:03:27 +0000 (UTC) Keywords: testing, debug, question Posted-Date: 13 Mar 2013 00:03:26 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:870 I am currently writing a simple byte compiler for a simple dialect of Lisp, and am wondering what is the best practice for testing such a compiler. It is certainly possible to run the compiler on some test code and then compare the code it generates with some reference code, but as the code samples become more complicated that rapidly becomes unwieldy. Would it instead be better to test the compiler by actually running the code it generates, and then comparing the results with what the code snippet is supposed to evaluate to? Any other ideas on how to go about testing the code generator? What about when optimizations are being performed?