www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Lexical, Syntatic and Semantic Merge of D Source Code

reply =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
Now that we have reasonable support for lexing and parsing D in D 
through Dscanner/libdparse/DCD I believe it would be worth the 
effort to try to implement D-specific merge algorithms that 
operate on either the

- D token stream or
- a D parse tree

possibly making use of semantic information.

This would also require functions that write them back to the 
original source representation, of course preserving whitespace 
indentations.

A token-based merger would be quite easy to implement and will 
resolve conflicts where multiple symbol renamings have occurred 
on the same line. Something that current mainstream line-based 
algorithms cannot handle. This could be useful when test-merging 
Git branches on Github.

It also could be that these algorithms will have things in common 
with DustMite's algorithms. What do you say, Cybershadow?

I could help implementing these ideas when necessary.

Have perhaps anybody already cooked up some D implementations of 
generic diff/merge algorithms? If not could anybody point out a 
good reference implementation in C/C++ to start with?
Jul 11 2014
next sibling parent =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
On Friday, 11 July 2014 at 13:58:53 UTC, Nordlöw wrote:

Other languages already have this through proprietary software. 
See for example

http://www.semanticmerge.com/
Jul 11 2014
prev sibling next sibling parent =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
On Friday, 11 July 2014 at 13:58:53 UTC, Nordlöw wrote:
 the effort to try to implement D-specific merge algorithms that
Correction: If mean the effort to try to implement D-specific diff and merge algorithms .
Jul 11 2014
prev sibling parent reply "Joakim" <dlang joakim.airpost.net> writes:
On Friday, 11 July 2014 at 13:58:53 UTC, Nordlöw wrote:
 Now that we have reasonable support for lexing and parsing D in 
 D through Dscanner/libdparse/DCD I believe it would be worth 
 the effort to try to implement D-specific merge algorithms that 
 operate on either the

 - D token stream or
 - a D parse tree

 possibly making use of semantic information.

 This would also require functions that write them back to the 
 original source representation, of course preserving whitespace 
 indentations.

 A token-based merger would be quite easy to implement and will 
 resolve conflicts where multiple symbol renamings have occurred 
 on the same line. Something that current mainstream line-based 
 algorithms cannot handle. This could be useful when 
 test-merging Git branches on Github.

 It also could be that these algorithms will have things in 
 common with DustMite's algorithms. What do you say, Cybershadow?

 I could help implementing these ideas when necessary.

 Have perhaps anybody already cooked up some D implementations 
 of generic diff/merge algorithms? If not could anybody point 
 out a good reference implementation in C/C++ to start with?
It's a good idea, something I've thought would be nice before, and a first step towards the Dfix concept Andrei has endorsed: http://forum.dlang.org/thread/sggntfmffiicpymovtys forum.dlang.org?page=2#post-ughxvktaonclzddyicve:40forum.dlang.org
Jul 12 2014
parent "Stefan Koch" <uplink.coder gmail.com> writes:
On Saturday, 12 July 2014 at 10:08:35 UTC, Joakim wrote:
 It's a good idea, something I've thought would be nice before, 
 and a first step towards the Dfix concept Andrei has endorsed:
There is something I found a great insperation is coccinelle http://coccinelle.lip6.fr/ it looks like a perfect match for starting the dfix endevaur
Jul 13 2014