Mimic: Computing Models for Opaque Code
This project requires
node, its package manager
npm, as well as
grunt to run. It also requires
make. Make sure they are installed first (Ubuntu and alike):
sudo apt-get install nodejs-legacy npm make sudo npm install -g grunt-cli
Then, install all dependencies via
Finally build the project:
You may want to make sure that all tests pass to verify the build by running
Note: We have mostly tried running this prototype on Ubuntu. A quick test on OS X seemed to have trouble installing some of the dependencies.
To run the model synthesis, the script
mimic can be used. It's usage is as follows:
As an example, the following command synthesizes code for the identify function:
./mimic --function "return x" --argnames "x" --arguments "1" "2"
Mimic works by running multiple instances of
mimic-core internally, each with a different random seed, and stops as soon as one of them succeeds. To understand the tool a little better, it is possible to run
mimic with the option
--debug, which will only launch a single copy of
mimic-core, and output various information along the way. For example:
./mimic --function "return x" --argnames "x" --arguments "1" "2" --debug
It is also possible to run
mimic-core directly. Furthermore, we have collected a few examples from the array standard library, and the script
Finally, there are two more useful scripts included:
scripts/experiment.py repeats runs of mimic for all examples and gathers statistics. The script
scripts/process.py can then be used to analyze that information. Pass
--help to them to get more information on how to use them.
Tests are written using mocha, and can be run by the following command:
The model synthesis code is distributed under the Apache License.