Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
/ perses Public archive
forked from uw-pluverse/perses

Language-agnostic program reducer.

License

Notifications You must be signed in to change notification settings

tabjy/perses

 
 

Repository files navigation

Perses: Syntax-Directed Program Reduction

Perses is a language-agnostic program reducer to minimize a program with respect to a set of constraints. It takes as input a program to reduce, and a test script which specifies the constraints. It outputs a minimized program which still satisfies the constraints specified in the test script. Compared to Delta Debugging and Hierarchical Delta Debugging, Perses leverages the syntax information in the Antlr grammar, and prunes the search space by avoiding generating syntactically invalid programs.

Supported Languages

Currently, Perses supports reduction for the following programming languages:

  • C: [c]
  • Cpp: [cc, cpp, cxx]
  • Rust: [rs]
  • Scala: [scala, sc]
  • Java: [java]
  • JavaScript: [javascript, js]
  • Python3: [py, py3]
  • Go: [go]
  • PHP: [php]
  • Ruby: [rb]
  • SQLite: [sqlite]
  • Solidity: [sol]
  • System_Verilog: [v, sv]
  • SMTLIBv2: [smt2]

Support for other languages is coming soon.

Obtain and Run

There are three ways to obtain Perses.

  • Download a prebuilt release JAR file from our release page, for example,

    wget https://github.com/perses-project/perses/releases/download/v1.4/perses_deploy.jar
    java -jar perses_deploy.jar [options]? --test-script <test-script.sh> --input-file <program file>
    
  • Clone the repo and build Perses from the source.

    git clone https://github.com/perses-project/perses.git
    cd perses
    bazel build //src/org/perses:perses_deploy.jar
    java -jar bazel-bin/src/org/perses/perses_deploy.jar [options]? --test-script <test-script.sh> --input-file <program file>
    
  • If you want to always use the trunk version of Perses, perses-trunk automatically downloads and builds the latest version. NOTE: Bazel is the prerequisite to run perses-trunk successfully.

    wget https://raw.githubusercontent.com/perses-project/perses/master/scripts/perses-trunk
    chmod +x perses-trunk
    ./perses-trunk [options]? --test-script <test-script.sh> --input-file <program file>
    

Important Flags

  • --test-script <test-script.sh>: The script encodes the constraints that both of the original program file and the reduced version should satisfy. It should return 0 if the constraints are satisfied.

  • --input-file : the program needs to be reduced. Currently, Perses supports C, Rust, Java and Go. Note that we can easily support any other languages, if the specific language can be parsed by an Antlr parser.

Check all available command line arguments

java -jar perses_deploy.jar  --help

License

GNU General Public License 3.

Reference

Perse was first published at International Conference on Software Engineering 2018 as a full research paper.

@inproceedings{perses,
  author = {Sun, Chengnian and Li, Yuanbo and Zhang, Qirun and Gu, Tianxiao and Su, Zhendong},
  title = {Perses: Syntax-Guided Program Reduction},
  year = {2018},
  publisher = {Association for Computing Machinery},
  doi = {10.1145/3180155.3180236},
  booktitle = {Proceedings of the 40th International Conference on Software Engineering},
  pages = {361–371},
}

About

Language-agnostic program reducer.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 45.7%
  • C 27.2%
  • C++ 8.3%
  • Go 5.3%
  • Java 4.4%
  • Solidity 2.5%
  • Other 6.6%