# Table of Contents
1. [Requirements](https://github.com/binsec/xyntia/blob/master/#requirements)
2. [Installation](https://github.com/binsec/xyntia/blob/master/#installation)
3. [Usage](https://github.com/binsec/xyntia/blob/master/#usage)
1. [Synthesizing functions from fun.ml predefined functions](https://github.com/binsec/xyntia/blob/master/#synthesizing-functions-from-funml-predefined-functions)
2. [Synthesizing functions from sampling files](https://github.com/binsec/xyntia/blob/master/#synthesizing-functions-from-sampling-files)
3. [Grammar abbreviations](https://github.com/binsec/xyntia/blob/master/#grammar-abbreviations)
4. [Heuristic abbreviations](https://github.com/binsec/xyntia/blob/master/#heuristic-abbreviations)
4. [Experiments](https://github.com/binsec/xyntia/blob/master/#experiments)
5. [Synthesize all blocks from a execution trace](https://github.com/binsec/xyntia/blob/master/#synthesize-all-blocks-from-a-execution-trace)
6. [Synthesize a specific output](https://github.com/binsec/xyntia/blob/master/#synthesize-a-specific-output)
7. [References](https://github.com/binsec/xyntia/blob/master/#references)
# Requirements
## System requirements
On debian like systems, run the following command:
```
sudo apt install libgmp3-dev gcc-multilib gdb python3 python3-pip python3-tqdm z3
```
## OCaml requirements
- [OCaml](https://github.com/binsec/xyntia/blob/master/https://ocaml.org/docs/install.fr.html) (>= 4.09)
- [Dune](https://github.com/binsec/xyntia/blob/master/https://github.com/ocaml/dune) (>= 1.11.4)
- [Zarith](https://github.com/binsec/xyntia/blob/master/https://github.com/ocaml/Zarith)
- [Yojson](https://github.com/binsec/xyntia/blob/master/https://github.com/ocaml-community/yojson) (>= 1.7.0)
- [Qcheck](https://github.com/binsec/xyntia/blob/master/https://github.com/c-cube/qcheck/) (>= 0.20)
You can install all the packages above with [opam](https://github.com/binsec/xyntia/blob/master/https://opam.ocaml.org/).
## Symbolic execution engine
Xyntia is a standalone tool which takes I/O example as input and synthesize a corresponding expression.
Still, in practice, you do not want to give these I/O examples by hand.
Thus we give scripts to automatically sample them from a given binary.
It relies on the Binsec symbolic execution engine:
- [Binsec](https://github.com/binsec/xyntia/blob/master/https://binsec.github.io/) (version >= 0.6.3)
# Installation
First, if you do not have a opam switch for an ocaml version >= 4.09 do:
```
$ opam switch create . 4.09 # or any version >= 4.09
$ eval $(opam env)
```
Then you can install ocaml dependencies presented previously using `opam install `.
Finally, to install Xyntia, execute:
```
$ make
$ make install
```
# Usage
The help of Xyntia is available through `xyntia -help`. In the following we will explain the two ways for using Xyntia.
## Synthesizing functions from fun.ml predefined functions
The module Fun from src/fun.ml contains a list of sample functions that can be used to test Xyntia without the need of processing a sampling file.
To run Xyntia on one of the functions in Fun, run the following command:
```
$ xyntia [-ops ] [-time