Doubt about compiler: Front-End vs Back-End

Curious just at curious.com
Mon Feb 17 02:55:56 UTC 2020


Hi, could anyone shed a light about the Frond-End and Back-End?

I understood the Back-End part, where "roughly" each compiler 
will generate a machine code based on a IR (Intermediate 
Representation) generated by the Front-End.

But I'm having trouble with the Front-End part, and for what I 
gather here: https://wiki.dlang.org/DMD_Source_Guide

> The front-end (DMD-FE) implements all things D-specific: lexing 
> and parsing D syntax, instantiating templates, producing error 
> messages, etc. The same front-end code is used by DMD, GDC and 
> LDC.

Note the ending: "The same front-end code is used by DMD, GDC and 
LDC."

But what the meaning of this sentence?

These are 3 different projects so how they share the SAME 
front-end or how they are connected? Is it a source written in 
*.CPP for example and the 3 compilers uses the same source? Or 
the "SAME" means each compiler needs to implement the same code?

Looking over Github: https://github.com/dlang/ I see DMD, Phobos 
and so on, but no separated project called Front-End.

Thanks in advance.


More information about the Digitalmars-d-learn mailing list