About the front-end & dogfood

Russell Lewis webmaster at villagersonline.com
Fri Mar 7 14:21:21 PST 2008


Anders F Björklund wrote:
> Bill Baxter wrote:
> 
>> Assuming I'm right and there is a C interface on any back end that 
>> matters, there shouldn't be any problem writing the front end in D, 
>> just extern(C) where necessary.
>>
>> Right?
> 
> Hmm, perhaps I'm missing something obvious here, but what would you use
> to bootstrap the front end with ? Some kind of D-to-C transmogrifier ?

The inelegant, but practical, answer is "the previous version of the D 
compiler."  It's how gcc works, basically.  When you download gcc to a 
box, it has a bootstrap mode which is designed to be compilable on just 
about any old C compiler.  Once that is built, then that bootstrap 
compiler is used to actually compile the gcc code (the full gcc sources 
use some features which might or might not work with other compilers). 
At least, that's how I remember it.

This obviously doesn't work if you are the first guy to write a compiler 
on a given platform, but on an existing platform with existing historic 
compilers, it works.

<plug>

This is another good reason for "dsimpl," which I suggested (in a 
previous post) that we write.  You could write the front-end in complex, 
advanced D, translate it to "simple D" using "dsimpl" and then build the 
compiler using a simplistic D compiler.

</plug>



More information about the Digitalmars-d mailing list