Doubt about compiler: Front-End vs Back-End

Curious just at curious.com
Mon Feb 17 03:22:19 UTC 2020


On Monday, 17 February 2020 at 03:07:33 UTC, Adam D. Ruppe wrote:
> On Monday, 17 February 2020 at 02:55:56 UTC, Curious wrote:
>> Note the ending: "The same front-end code is used by DMD, GDC 
>> and LDC."
>>
>> But what the meaning of this sentence?
>
> They literally share like 97% of the code.
>
>> Looking over Github: https://github.com/dlang/ I see DMD, 
>> Phobos and so on, but no separated project called Front-End.
>
> Compare dmd:
> https://github.com/dlang/dmd/
>
> to ldc:
> https://github.com/ldc-developers/ldc/
>
> dmd has a `src` folder. ldc has a `dmd` folder. inside those 
> you'll find most the content is identical - written in D btw.
>
> gdc is a little different because it is based on an older 
> version of dmd when it was written in C++ before it was ported 
> to D. it will be moving to the D version probably later this 
> year too, but it had to be C++ at first for gcc inclusion. But 
> even so, it is still almost all the same code and even has some 
> patches from new D versions ported back to c++ for it.
>
>
> But basically all three compilers are branches of the same 
> codebase with most the same patches applied going forward so 
> they share the vast, vast majority of frontend code.

Hmm I see now, so DMD compiler has both Front-End and Back-End, 
the LDC in this case is getting only the Front-End part from DMD 
project.

So since the Front-End written in D and the GDC is still the 
older version (C++), then they need to replicate the new features 
from D to C++. Well this seems a pain.

By the way since the Front-End is in D, so it's occurring 
bootstrapping, interesting.

Thanks.


More information about the Digitalmars-d-learn mailing list