Lexical, Syntatic and Semantic Merge of D Source Code

Joakim via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 12 03:08:34 PDT 2014


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


More information about the Digitalmars-d mailing list