Re: Testing strategy for compiler

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Thu, 17 Jun 2010 20:19:36 +0000 (UTC)

          From comp.compilers

Related articles
Testing strategy for compiler kuangpma@gmail.com (kuangpma) (2010-06-16)
Re: Testing strategy for compiler gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-06-17)
Re: Testing strategy for compiler zaimoni@zaimoni.com (Kenneth 'Bessarion' Boyd) (2010-06-17)
Re: Testing strategy for compiler ott@mirix.org (Matthias-Christian Ott) (2010-06-18)
Re: Testing strategy for compiler gene.ressler@gmail.com (Gene) (2010-06-18)
Re: Testing strategy for compiler gneuner2@comcast.net (George Neuner) (2010-06-18)
Re: Testing strategy for compiler gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-06-18)
Re: Testing strategy for compiler ott@mirix.org (Matthias-Christian Ott) (2010-06-19)
[7 later articles]
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Thu, 17 Jun 2010 20:19:36 +0000 (UTC)
Organization: Aioe.org NNTP Server
References: 10-06-037
Keywords: testing, parse
Posted-Date: 18 Jun 2010 01:38:51 EDT

kuangpma <kuangpma@gmail.com> wrote:


> Say I have written a hand crafted lexer/parser/code gen.... to make a
> complete compiler. The question is how to test it? Since user can have
> millions possible ways of writing their program (with many different
> types of syntax errors) and it is difficult to test all the possible
> cases. So is there any good ways to test the compiler? How do those
> big guys (MS/Borland...) tested their compiler? Thanks.


There are stories from the olden days of feeding cards from the card
recycling bin into compilers to test them. (Punched cards are a
higher quality paper, and were considered more valuable than other
recycled paper.) Not perfect, but relatively easy to do.


I am not sure it exactly answers the question, but there is a
description by Knuth of his tests on TeX, which include making sure
that the tests execute all parts of the program except those leading
to fatal errors. It is done by successive refinement, where you find
the part not executed and then modify the test data such that it will
execute that part. With a little luck, it eventually converges to a
complete test. That is mainly to make sure it process the cases
without syntax errors correctly, though.


-- glen



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.