DMD as a library - recap, next steps

RazvanN razvan.nitu1305 at gmail.com
Wed Jun 17 04:58:56 UTC 2020


On Tuesday, 16 June 2020 at 11:34:43 UTC, Jacob Carlborg wrote:
> On Tuesday, 16 June 2020 at 09:07:19 UTC, RazvanN wrote:
>
>> 2. Semantic analysis mutates the AST in a way that makes it 
>> impossible for you to reason about what was there in the first 
>> place.
>
> Ideally the compiler should be modified to preserve all 
> information through all phases of the compilation.
>
> In my tool I had to make quite a bit of extra effort to 
> preserve the information I needed. Basically walking the AST 
> twice, once before running the semantic analyzer and once after.
>
> --
> /Jacob Carlborg

Would it have been easier if you had the ability override certain 
portions of the semantic analysis? What we are trying to push 
forward now is the ability to extend the semantic visitor and 
override/extend functionality as you wish, however, since some 
nodes have a lot of code that does semantic on them (CallExp 
~1000 lines of code) you would have to copy paste a lot of code 
and modify only what interests you.
The advantage is that you perform semantic only once.


More information about the Digitalmars-d mailing list