Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Testing a compiler is very hard because the unit tests which validate that some code transformation is happening do not prove that the code transformation will be correct in all conceivable situations in which it occurs.

If you pin down too much in test cases, on the other hand, it will be hard to make changes to the compiler without breaking tons of tests.

I think, the best way to test a compiler is to have a large standard library or other body of code, including that compiler written in itself. Recompile the whole thing and then recompile it again with the compiled compiler and again. By the third iteration, you should have it a fixed point. That doesn't prove thing are correct, but it gives a lot of confidence, especially if the code base is large and uses a lot of the language. The second piece of confidence is that all that compiled code passes its tests.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: