New command in mgf_dev to test isomorphism between two syntax trees #197

Closed
opened 2025-02-10 11:59:21 +01:00 by wetneb · 1 comment
Owner

When evaluating merge drivers, it is a common approach to search for merge commits in a large set of git repositories, and use the files in those merge commits as gold standard to compare the outputs of merge drivers to (in the case of a conflict-free result). This was done for instance when developing Spork.

Comparing the files for exact contents equality is quite strict. For instance, I don't care too much about the indentation details of the merge driver's output, because those will get normalized by a linter afterwards. It still makes sense to produce a formatting that's as good as possible, but I find it more important to work on bugs which affect the correctness of the merged code.

Therefore, I would find it useful to have a new command in the mgf_dev binary, which compares two files for isomorphism of their AST.
In a first version, the command could simply use the existing method AstNode::is_isomorphic_to on the roots of the parsed files, which would already ignore formatting differences.
In an improved version, the algorithm could be refined to accept differences of ordering within the children of commutative parents.

When evaluating merge drivers, it is a common approach to search for merge commits in a large set of git repositories, and use the files in those merge commits as gold standard to compare the outputs of merge drivers to (in the case of a conflict-free result). This was done for instance when developing [Spork](https://github.com/ASSERT-KTH/spork). Comparing the files for exact contents equality is quite strict. For instance, I don't care too much about the indentation details of the merge driver's output, because those will get normalized by a linter afterwards. It still makes sense to produce a formatting that's as good as possible, but I find it more important to work on bugs which affect the correctness of the merged code. Therefore, I would find it useful to have a new command in the `mgf_dev` binary, which compares two files for isomorphism of their AST. In a first version, the command could simply use the existing method `AstNode::is_isomorphic_to` on the roots of the parsed files, which would already ignore formatting differences. In an improved version, the algorithm could be refined to accept differences of ordering within the children of commutative parents.
Author
Owner

The first version of this isomorphism is implemented, leaving this issue open to add support for commutative parents.

The first version of this isomorphism is implemented, leaving this issue open to add support for commutative parents.
wetneb self-assigned this 2025-03-09 15:33:59 +01:00
ada4a closed this issue 2025-03-13 10:05:04 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: mergiraf/mergiraf#197
No description provided.