Re: Testing strategy for compiler

Matthias-Christian Ott <ott@mirix.org>
Sat, 19 Jun 2010 19:05:26 +0200

          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)
Re: Testing strategy for compiler gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-06-19)
Re: Testing strategy for compiler jm@bourguet.org (Jean-Marc Bourguet) (2010-06-21)
Re: Testing strategy for compiler dot@dotat.at (Tony Finch) (2010-06-21)
Re: Testing strategy for compiler gneuner2@comcast.net (George Neuner) (2010-06-21)
Re: Testing strategy for compiler news@cuboid.co.uk (Andy Walker) (2010-06-22)
Re: Testing strategy for compiler barry.j.kelly@gmail.com (Barry Kelly) (2010-06-22)
[1 later articles]
| List of all articles for this month |

From: Matthias-Christian Ott <ott@mirix.org>
Newsgroups: comp.compilers
Date: Sat, 19 Jun 2010 19:05:26 +0200
Organization: Compilers Central
References: 10-06-037 10-06-044 10-06-050
Keywords: testing, comment
Posted-Date: 19 Jun 2010 14:34:51 EDT

On Fri, Jun 18, 2010 at 02:58:24PM -0400, George Neuner wrote:
> On Fri, 18 Jun 2010 10:45:21 +0200, Matthias-Christian Ott
> <ott@mirix.org> wrote:
>
> >If you have a formal (generative) grammar for your language, you can
> >generate all valid strings of language and test whether your parser
> >recognises them. So you have practical tests which also cover obscure
> >programmes. You could use yagg [1] for this purpose.
> >
> >[1] http://sourceforge.net/projects/yagg/
>
> Our esteemed moderator wrote:
> >[Any useful language has an infinite number of valid strings. I
> >suppose you could generate enough to test that it can match each rule
> >in the grammar. And this doesn't address the harder question of
> >verifying that it'll reject invalid programs. -John]
>
> You can generate enough that each language construct has every
> possible use case covered. Many newbies forget to thoroughly test
> recursive constructs and recursively applied algorithms. Somebody (I
> forget who) said: "there are only three good numbers: 0, 1 and
> infinity ... and sometimes 2".


You generate a huge amount of input strings and test whether they are
accepted by the parser. Of course you can't generate all string unless
your language is finite, but can generate strings that no human would
think of.


> But John is correct that this won't test semantics ... syntactically
> correct programs can still be invalid. You need to make sure the
> compiler rejects anything that is semantically wrong.


Read the second paragraph of my E-Mail.


Regards,
Matthias-Christian
[I would be astonished if anyone ever managed to do a mechanical proof of a
non-trivial piece of a compiler. And even if they did, they'd still never
know whether there were bugs in the formal description. -John]


Post a followup to this message

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