Compiler development

foobar foo at bar.com
Sun Apr 1 15:02:56 PDT 2012


On Sunday, 1 April 2012 at 21:26:44 UTC, Tim Krimm wrote:
> What is the process for developing the dmd compiler?
>
> Years ago, when I worked on the IBM PLX/PLAS compiler, we had a
> large collection of test case files.
>
> We would create two executable versions of the compiler.
> One executable was the "good" version and the other version was
> the 'GOOD' version with the developers changes.
>
> We would run a script.
>
>       1) first compiler runs the test cases.
>       2) second compiler runs the test cases.
>       3) each compiler generated its own unique directory 
> structure
> of results.
>       4) the results can be compiler lists, assembly listings, 
> etc
>       5) the two directory structures are compared with a 
> compare
> utility
>       6) the developer looks through the compare program output
>       7) if the differences make sense, the changes are added to
> the
> code base.
>
> pros
>        helps reduce breakage of existing code when adding new
> features
>
> cons
>        can slow down development looking through a bunch of 
> compare
> listings.
>
> Our script was very complex, it allowed us to change compiler
> settings and change what we wanted to compare and what was
> generated by the compiler.
> Also the compare utility had settings that allowed it to only 
> put
> out differences or differences with a couple of lines before and
> after to help locate the cause of the differences. or the
> developer could just go back and rerun the particular test case
> if it needed further analysis.
>
> Note:The dmd compiler is written in C++ not D, so you do not 
> have
> the luxury of builtin unit tests.

Or in other words you did regression testing.

Regarding DMD - Walter has a test suite for it for the same 
purpose. I don't know the specifics of it as I never looked at it 
and not even sure whether it's open source or not. The core devs 
would be able to provide more specifics.

Please note that while Walter writes in c++ he has a unique style 
of it - some claim it's very D like.


More information about the Digitalmars-d mailing list