Lang.NEXT panel (dfix)

Bruno Medeiros via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Jun 17 08:45:45 PDT 2014


On 17/06/2014 07:25, Jacob Carlborg wrote:
> On 16/06/14 15:43, Bruno Medeiros wrote:
>
>> What's keeping us from having such a tool? It seems that after one has a
>> decent parser (that also keeps tracks of the source ranges of AST
>> nodes), it's easy to write code that does syntactic modifications and
>> then rewrites the source code. And there's several D parsers out there
>> already - so it should be too much effort to get there.
>> Even I am working on a tool that can be easily retrofitted for this
>> purpose.
>>
>> Or maybe I am misunderstanding the amount of semantic analysis that
>> would typically be required? Can someone give some examples of
>> modifications that would be useful for such a dfix tool? (I haven't yet
>> had the time to watch the full panel video, if that's relevant)
>
> * The parser haven't been available for that long (I think)
> * Can they handle whole language?

Dunno about DScanner, but if it's being used in DCD, I'd guess it can 
handle the whole language, or be fairly close to it.

Similarly, there is also DParser2 from MonoD and the DDT parser (for the 
tool I'm working on)

> * Semantic analysis is needed. Otherwise as soon as someone uses
> templates or mixins the tool won't properly work
>

I think there would be a lot of modifications that one can do without 
semantic analysis (or limited analysis). But that's why I asked for 
examples of dfix scenarios.

Adding "final" to every method in certain classes could be done without 
semantic analysis. Reworking certain constructs to different constructs 
possibly as well (for example change foreach_reverse to just foreach usage)

-- 
Bruno Medeiros
https://twitter.com/brunodomedeiros


More information about the Digitalmars-d-announce mailing list