Add AST merging function, based on finding longest common substring