www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Refactoring D as an MSc Project

reply "Jamie" <j.taylor.m91 gmail.com> writes:
Hello all!

This is my first post on the forums. I'm interested in possibly 
creating a refactoring tool for D for my MSc dissertation (I 
notice there is currently no refactoring in D?). I wanted to ask 
if this is possible with D's current state?

More specifically:
- Can I easily access things such as the AST?
Mar 02 2015
next sibling parent reply "Brian Schott" <briancschott gmail.com> writes:
On Monday, 2 March 2015 at 21:50:46 UTC, Jamie wrote:
 Hello all!

 This is my first post on the forums. I'm interested in possibly 
 creating a refactoring tool for D for my MSc dissertation (I 
 notice there is currently no refactoring in D?). I wanted to 
 ask if this is possible with D's current state?

 More specifically:
 - Can I easily access things such as the AST?
This should save you a lot of time: https://github.com/Hackerpilot/libdparse
Mar 02 2015
next sibling parent "Jamie" <j.taylor.m91 gmail.com> writes:
Thanks, I'll give it a look :)
Mar 02 2015
prev sibling parent reply "Jamie" <j.taylor.m91 gmail.com> writes:
On Monday, 2 March 2015 at 21:54:05 UTC, Brian Schott wrote:
 On Monday, 2 March 2015 at 21:50:46 UTC, Jamie wrote:
 Hello all!

 This is my first post on the forums. I'm interested in 
 possibly creating a refactoring tool for D for my MSc 
 dissertation (I notice there is currently no refactoring in 
 D?). I wanted to ask if this is possible with D's current 
 state?

 More specifically:
 - Can I easily access things such as the AST?
This should save you a lot of time: https://github.com/Hackerpilot/libdparse
I've had a look around and it seems promising, however are there any usage examples poking around somewhere I could look at? Also, does the produced AST have location information?
Mar 02 2015
next sibling parent "John Colvin" <john.loughran.colvin gmail.com> writes:
On Tuesday, 3 March 2015 at 01:17:33 UTC, Jamie wrote:
 On Monday, 2 March 2015 at 21:54:05 UTC, Brian Schott wrote:
 On Monday, 2 March 2015 at 21:50:46 UTC, Jamie wrote:
 Hello all!

 This is my first post on the forums. I'm interested in 
 possibly creating a refactoring tool for D for my MSc 
 dissertation (I notice there is currently no refactoring in 
 D?). I wanted to ask if this is possible with D's current 
 state?

 More specifically:
 - Can I easily access things such as the AST?
This should save you a lot of time: https://github.com/Hackerpilot/libdparse
I've had a look around and it seems promising, however are there any usage examples poking around somewhere I could look at?
https://github.com/Hackerpilot/Dscanner uses it. Walking the AST is done with the visitor pattern, so if you're familiar with that it should make sense.
Mar 03 2015
prev sibling parent "Brian Schott" <briancschott gmail.com> writes:
On Tuesday, 3 March 2015 at 01:17:33 UTC, Jamie wrote:
 On Monday, 2 March 2015 at 21:54:05 UTC, Brian Schott wrote:
 On Monday, 2 March 2015 at 21:50:46 UTC, Jamie wrote:
 Hello all!

 This is my first post on the forums. I'm interested in 
 possibly creating a refactoring tool for D for my MSc 
 dissertation (I notice there is currently no refactoring in 
 D?). I wanted to ask if this is possible with D's current 
 state?

 More specifically:
 - Can I easily access things such as the AST?
This should save you a lot of time: https://github.com/Hackerpilot/libdparse
I've had a look around and it seems promising, however are there any usage examples poking around somewhere I could look at? Also, does the produced AST have location information?
Not all AST nodes have location information right now. I've mostly been adding that as I need it for other projects. Any field of an AST class that has a type "Token" will have line, column and byte offsets. These projects use libdparse: https://github.com/Hackerpilot/DCD https://github.com/Hackerpilot/Dscanner https://github.com/Hackerpilot/dfmt https://github.com/economicmodeling/harbored
Mar 03 2015
prev sibling next sibling parent Rikki Cattermole <alphaglosined gmail.com> writes:
On 3/03/2015 10:50 a.m., Jamie wrote:
 Hello all!

 This is my first post on the forums. I'm interested in possibly creating
 a refactoring tool for D for my MSc dissertation (I notice there is
 currently no refactoring in D?). I wanted to ask if this is possible
 with D's current state?

 More specifically:
 - Can I easily access things such as the AST?
You may also be interested in SDC[0]. [0] https://github.com/deadalnix/SDC
Mar 02 2015
prev sibling next sibling parent Etienne Cimon <etcimon gmail.com> writes:
On 2015-03-02 16:50, Jamie wrote:
 Hello all!

 This is my first post on the forums. I'm interested in possibly creating
 a refactoring tool for D for my MSc dissertation (I notice there is
 currently no refactoring in D?). I wanted to ask if this is possible
 with D's current state?

 More specifically:
 - Can I easily access things such as the AST?
Mono-D https://github.com/aBothe/Mono-D/ D_Parser as a submodule. I use mono-d all the time to work on my libraries. Currently the refactoring feature in monodevelop is pretty much useless because nobody implemented it I guess.
Mar 02 2015
prev sibling parent "Jonas Drewsen" <nospam4321 hotmail.com > writes:
On Monday, 2 March 2015 at 21:50:46 UTC, Jamie wrote:
 Hello all!

 This is my first post on the forums. I'm interested in possibly 
 creating a refactoring tool for D for my MSc dissertation (I 
 notice there is currently no refactoring in D?). I wanted to 
 ask if this is possible with D's current state?

 More specifically:
 - Can I easily access things such as the AST?
I have planned to do refactoring tools myself for D for use in Deadcode (an editor). I'm currently using libdparse myself for other things, but the overview given for SDC last dconf looked very promising. I would be very interested in following what you do and be an early adopter if possible. /Jonas
Mar 03 2015