Doubt about compiler: Front-End vs Back-End

Adam D. Ruppe destructionator at gmail.com
Mon Feb 17 03:07:33 UTC 2020


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.


More information about the Digitalmars-d-learn mailing list