Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nobrakal committed Jan 14, 2020
1 parent 10fd736 commit 2f61450
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,25 @@ Asak is an OCaml library that allows to identify similar OCaml codes.

## Why ?

* For teaching: the module `Asak.Partition` offers a function `create` that produces a partition of codes implementing the same function, where two codes are in the same class if they are syntactically "close".
### For teaching

* For redundancy detection: the binary `anzad` provides functions to inspect an OCaml project built with `dune` and compare it with a database.
The module `Asak.Partition` offers a function `create` that produces a partition of codes implementing the same function, where two codes are in the same class if they are syntactically "close".

### For redundancy detection
The binary `anzad` can detect redundant definitions of an OCaml project built with `dune` and compare it with a database of previously analyzed projects.

To use it on a project with sources in `src/`, run:

```
dune build @check
anzad src/
```

## How ?

The idea is to compare AST (Abstract Syntax Tree) of codes. However, the OCaml AST is too rich for our purpose (since, for example, `match x with ...` and `function ...` generate two different AST). We decided instead to use the Lambda language, an intermediate language in the OCaml compilation pipeline, where such syntactic sugar is optimized away.

To efficiently compare Lambda trees, we use the idea of [Chilowicz et al.](http://igm.univ-mlv.fr/~chilowi/research/syntax_tree_fingerprinting/syntax_tree_fingerprinting_ICPC09.default_pdf.pdf) which consist in hashing recursively trees.
To efficiently compare Lambda trees, we use the methodology of [Chilowicz et al.](http://igm.univ-mlv.fr/~chilowi/research/syntax_tree_fingerprinting/syntax_tree_fingerprinting_ICPC09.default_pdf.pdf) which consist in hashing recursively trees.

We then compare hashes and provide a clustering of the closest functions.

Expand Down

0 comments on commit 2f61450

Please sign in to comment.