Lexical, Syntatic and Semantic Merge of D Source Code

"Nordlöw" via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 11 06:58:51 PDT 2014


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?


More information about the Digitalmars-d mailing list