[spec] Phases of translation

Walter Bright newshound2 at digitalmars.com
Mon May 20 07:34:43 UTC 2019


On 5/19/2019 3:07 AM, Dibyendu Majumdar wrote:
> Hi,
> 
> In the introduction there is a section named 'Phases of Compilation'. Following 
> the convention used in C standard, I am calling this 'Translation Phases'; 
> translation is a more generic term too. See 
> https://github.com/dlang/dlang.org/pull/2646/files for some initial rewording.
> 
> The recent post 
> https://forum.dlang.org/post/xnoeazcqnysodqnjphhc@forum.dlang.org got me 
> thinking that actually we should expand the 'Translation Phases' section to 
> describe more formally how D code is parsed. I had a quick look at the D parsing 
> code. It seems that following an initial parse - presumably this constructs the 
> syntax tree - there are three deferred semantic parses. Are any details 
> available on what actually happens in each pass? I can read the code of course 
> but it would be helpful to get a high level picture.

The Translation Phases are conceptual, the compiler may not actually do them 
that way, it's just supposed to be "as if" they were done that way.

For example, the Digital Mars C/C++ compilers merge several of the translation 
phases.


More information about the Digitalmars-d mailing list