Skip to content
Compute mappings between arbitrary trees.
C++ Python Common Lisp Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.clang-format
.clang_complete
.gitignore
Makefile
README
display.py
sexp_dumper.py

README

Outline:

ast-diff is a tool that computes the difference between two trees.
ast-diff can read trees from files or the standard input, in s-expression
format.

A clang-based tool to generate C/C++ s-expressions : https://github.com/balayette/clang-sexpression

dispatch.py combines ast-diff and clang-sexpression and makes them easier to use.

ast-diff uses the Gumtree algorithm to compute mappings from nodes of a tree
to nodes of another tree.

Usage:

If you already have s-expressions that you want to compare:
42sh$ make
42sh$ ./ast-diff --diff test/while.sexp test/for.sexp

If you want dispatch.py to handle everything.
42sh$ ./dispatch directory... [--jobs=N] [--glob='*.c'] [--ex-glob='excluded_file.c']

And create the webinterface:
42sh$ ./display.py
Creates an out/index.html file

Papers:

Algorithm description:
* [1] Fine-grained and Accurate Source Code Differencing
* [2] Change Detection in Hierarchically Structured Information

Use cases:
* VulPecker: an automated vulnerability detection system based on code similarity analysis

* Generating simpler AST edit scripts by considering copy-and-paste

* Renaming and shifted code in structured merging: looking ahead for precision and performance

Related:
* A Feasibility Study of Using Automated Program Repair for Introductory Programming Assignments
You can’t perform that action at this time.