pymwp: MWP analysis in Python
pymwp is a tool for automatically performing static analysis on programs written in C, inspired by "A Flow Calculus of mwp-Bounds for Complexity Analysis". It analyzes resource usage and determines if a program's variables growth rates are no more than polynomially related to their inputs sizes. You can run our many examples on-line in our demo before installing it, or consult our list of supported C language features.
Documentation and Demo
Install latest release from PyPI
pip install pymwp
How to Use
To analyze a C file, run:
For all available options and help, run:
You can also use pymwp in a Python script:
from pymwp import Polynomial from pymwp.matrix import identity_matrix, show matrix = identity_matrix(3) matrix = Polynomial('m') matrix = Polynomial('w') matrix = Polynomial('p') show(matrix)
See documentation for available modules and methods.
Running from source
If you want to use the latest stable version (possibly ahead of latest release), use the version from source following these steps.
Clone the repository
git clone https://github.com/statycc/pymwp.git
Set up Python environment
install required packages
pip install -q -r requirements.txt
Run the analysis
From project root run:
python -m pymwp path/to_some_file.c
python -m pymwp c_files/basics/if.c
for all available options and help, run:
python -m pymwp