Compiler/Interpreter Validation Guidelines for C? 10
pjdepasq asks: "For my PhD work, I've developing a programming environment for novice users. It basically interprets the C programming language, plus or minus a few things as we teach the novice programming course here at Virginia Tech. In doing so, I'd like to have one of the students working with me use a compiler validation guideline to validate we're covering the key bases. For example, initially, I'd like them to ensure that the operator precendence is working correctly. My advisor tells me that NIST used to have a software product for doing this, but I don't see it there any longer for C. I'd really just be happy with some type of guide that the student can work from. Does anyone know of some type of free/cheap guideline we can utilize? It would likely need to include other types of validation, since we'll expand this effort later in the semester."
Re:compiler verification (Score:2)
Just throwing the compiler at gcc would break it in strange and unknowable ways.
And before it validates the first feature you implemented, it would break it in 500 strange and unknowable ways that you deliberately did not implement but would have to work around by hand.
Or was that your subtle joke?
--Blair
Language compiler validation services (Score:2, Informative)
Feed it code from _The C Puzzle Book_ (Score:2, Interesting)
Plum Hall & Others (Score:2, Interesting)
Plum Hall: http://www.plumhall.com/stec.html
Perennial: http://www.peren.com/pages/cvsa.htm
-----
Re:Cheap and cheerful (Score:1)
If you have a language that's "more-or-less C", follow C's rules. If you teach the students a broken set of precedence rules, you're not doing them any favours - you'll break any program that they make following your precedence rules.
This, I agree with. I've maintained code that relies on precedence. When you've been doing it for a few hours, they get screwed up in your head. Nice, obvious parens make everything so much easier, I sometimes wonder why it wasn't a requirement in the first place.
Knuth's work and grammar as requirements (Score:2, Informative)
If you go perusing through Donald Knuth's work (in this case, Digital Typography), you will see him mention a killer program he wrote for TeX. I'd cite the program name and page number if I had my copy, but I lent it out. In any event, this single TeX program/script/file tested every little nuance of the system abusively. In and of itself it was a gorgeous piece of work.
Shifting gears for a moment, most QA types will tell you that the best time to devise test cases is when a project is in late requirements or early design. You doubtless have a grammar for your "C-plus-or-minus" language--I would call that a great high-level design document!
Now putting this all together, shouldn't it be relatively straightforward to construct a C program (or set of C programs) that goes through every state of your grammar?
Sounds like a fun project for some undergrad students to work on in Compiler Design. (In fact, it might even be fun to generate a C program generator from that grammar to do it for you; but I digress...)
gcc testsuite (Score:1)
mean testsuite then the latest release of gcc has
a testsuite which runs under DejaGnu.