How can we make it easier to experiment with the compiler?

Iain Buclaw ibuclaw at gdcproject.org
Mon May 24 10:51:10 UTC 2021


On Monday, 24 May 2021 at 10:21:44 UTC, Walter Bright wrote:
> That doesn't really help, the dependencies are still there.

It makes it clear what they are for, which makes this statement:

> If I want to understand the code, I have to understand half of 
> the rest of the compiler.

obsolete.

> It is not critical that we fix target.d. It's just that it 
> would be better if its API was not AST nodes, but just values. 
> Let the caller construct the AST node from the information 
> provided.
>

The majority of the API are values, but it still needs to be fed 
AST information in order to make informative decisions.

For instance, how else would we be able to infer 
`isReturnOnStack` without a `TypeFunction`?  Even GDC needs the 
completed `TypeFunction`, as I generate a `tree` on-the-fly and 
pass that to GCC's back-end API to get said information.

> Like what we did for the C parser. I was happy to have it not 
> indirectly import everything in dmd when all it needed was a 
> couple values.
>
> I'm not saying any of this is easy.

Target's first goal of removing all `global.params.isXXX` fields 
was never going to be easy either. :-)


More information about the Digitalmars-d mailing list