Difftastic is effectively computing the "tree edit distance" between two ASTs, and there's a bunch of papers on this topic. Literature review is hard though: sometimes a paper takes a while to digest, only to realise that they're solving a slightly different problem.