Skip to content

balayette/ast-diff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Compute mappings between arbitrary trees.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published