{"id":13451371,"url":"https://github.com/facebook/SPARTA","last_synced_at":"2025-03-23T18:32:20.584Z","repository":{"id":37375805,"uuid":"132040907","full_name":"facebook/SPARTA","owner":"facebook","description":"SPARTA is a library of software components specially designed for building high-performance static analyzers based on the theory of Abstract Interpretation.","archived":false,"fork":false,"pushed_at":"2024-12-16T19:58:51.000Z","size":847,"stargazers_count":645,"open_issues_count":3,"forks_count":48,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-03-17T11:53:44.719Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-03T19:31:42.000Z","updated_at":"2025-03-02T20:24:30.000Z","dependencies_parsed_at":"2024-06-11T04:17:55.536Z","dependency_job_id":"a6e568b9-53c7-4d2e-ab7d-0b8746a0a084","html_url":"https://github.com/facebook/SPARTA","commit_stats":{"total_commits":257,"total_committers":38,"mean_commits":"6.7631578947368425","dds":0.8093385214007782,"last_synced_commit":"bd758a81954dc2c8fe75c8b32ab42d327fc4d895"},"previous_names":["facebookincubator/sparta"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FSPARTA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FSPARTA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FSPARTA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FSPARTA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebook","download_url":"https://codeload.github.com/facebook/SPARTA/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245149565,"owners_count":20568923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T07:00:52.709Z","updated_at":"2025-03-23T18:32:20.546Z","avatar_url":"https://github.com/facebook.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# SPARTA\n\n\u003cimg src=\"SPARTA.png\" width=\"300\" height=\"300\"/\u003e \n\n[![Support Ukraine](https://img.shields.io/badge/Support-Ukraine-FFD500?style=flat\u0026labelColor=005BBB)](https://opensource.fb.com/support-ukraine)\n![Rust Build](https://github.com/facebook/SPARTA/actions/workflows/rust.yml/badge.svg)\n![C++](https://github.com/facebook/SPARTA/actions/workflows/cmake.yml/badge.svg)\n[![crates.io](https://img.shields.io/crates/v/sparta.svg)](https://crates.io/crates/sparta)\n\nSPARTA is a library of software components specially designed for building high-performance static analyzers based on the theory of Abstract Interpretation.\n\n## Abstract Interpretation\n\n[Abstract Interpretation](https://en.wikipedia.org/wiki/Abstract_interpretation) is a theory of semantic approximation that provides a foundational framework for the design of static program analyzers. Static analyzers built following the methodology of Abstract Interpretation are mathematically sound, i.e., the semantic information they compute is guaranteed to hold in all possible execution contexts considered. Moreover, these analyzers are able to infer complex properties of programs, the expressiveness of which can be finely tuned in order to control the analysis time. Static analyzers based on Abstract Interpretation are routinely used to perform the formal verification of flight software in the aerospace industry, for example.\n\n## Why SPARTA?\n\nBuilding an industrial-grade static analysis tool based on Abstract Interpretation from scratch is a daunting task that requires the attention of experts in the field. The purpose of SPARTA is to drastically simplify the engineering of Abstract Interpretation by providing a set of software components that have a simple API, are highly performant and can be easily assembled to build a production-quality static analyzer. By encapsulating the complex implementation details of Abstract Interpretation, SPARTA lets the tool developer focus on the three fundamental axes in the design of an analysis:\n\n* **Semantics:** the program properties to analyze (range of numerical variables, aliasing relation, etc.)\n* **Partitioning:** the granularity of the properties analyzed (intraprocedural, interprocedural, context-sensitive, etc.)\n* **Abstraction:** the representation of the program properties (sign, interval, alias graph, etc.)\n\nSPARTA is an acronym that stands for **S**emantics, **PART**itioning and **A**bstraction.\n\n## Using SPARTA\n\nA detailed documentation for SPARTA can be found in the code of the library itself. It includes code samples, typical use cases and references to the literature. Additionally, the unit tests are a good illustration of how to use the API. The unit test for the [fixpoint iterator](test/MonotonicFixpointIteratorTest.cpp), in particular, implements a complete analysis (live variables) for a simple language.\n\nSPARTA is the analytic engine that powers most optimization passes of the [ReDex](https://github.com/facebook/redex) Android bytecode optimizer. The ReDex codebase contains multiple examples of analyses built with SPARTA that run at industrial scale. The [interprocedural constant propagation](https://github.com/facebook/redex/tree/master/service/constant-propagation) illustrates how to assemble the building blocks provided by SPARTA in order to implement a sophisticated yet scalable analysis.\n\n## Dependencies\n\nSPARTA requires Boost 1.71 or later.\n\n### macOS\n\nYou will need Xcode with the command line tools installed. To get the command line tools, please use:\n\n```\nxcode-select --install\n```\n\nBoost can be obtained via homebrew:\n\n```\nbrew install boost\n```\n\n### Ubuntu (64-bit)\n\nOn Ubuntu 16.04 or later, Boost can be installed through the package manager:\n\n```\nsudo apt-get install libboost-all-dev\n```\n\nFor earlier versions of Ubuntu, we provide a script to install Boost:\n\n```\nsudo ./get_boost.sh\n```\n\n## Setup\n\nSPARTA is a header-only C++ library. You can just copy the contents of the `include` directory to any location in the include path of your compiler.\n\nWe also provide a quick setup using cmake that builds all the tests:\n\n```\n# Assume you are in the SPARTA directory\nmkdir build-cmake\ncd build-cmake\n# .. is the root source directory of SPARTA\ncmake ..\ncmake --build .\n```\n\nTo run the unit tests, please type:\n\n```\nmake test\n```\n\nTo copy the header files into `/usr/local/include/sparta` and set up a cmake library for SPARTA, you can use the following command:\n\n```\nsudo make install\n```\n\n### CMake Setup\n\nIf you are using CMake for your project, you can also use SPARTA in the following ways:\n\n* A system-wide installation of SPARTA will contain a CMake configuration file that exports the library as `sparta::sparta`. This enables the use of `find_package` to locate SPARTA. For example:\n\n  ```cmake\n  find_package(Boost REQUIRED COMPONENTS thread) # required by SPARTA\n  find_package(sparta REQUIRED)\n  add_library(MyAnalysisLibrary)\n  target_link_libraries(MyAnalysisLibrary PUBLIC sparta::sparta)\n  ```\n\n* If you have cloned and \"built\" SPARTA locally, you can use a `find_package` call (such as the one above) and run CMake with the `-Dsparta_DIR=\u003cyour_sparta_build_dir\u003e` to load the library:\n\n  ```sh\n  # Assuming you are at the top-level of your project that uses SPARTA\n  mkdir build \u0026\u0026 cd build\n  cmake .. -Dsparta_DIR=path/to/your/sparta/build\n  ```\n\n* SPARTA can be added as a subdirectory in your project:\n\n  ```cmake\n  # assuming you have cloned SPARTA into a folder named sparta\n  add_subdirectory(sparta)\n  add_library(MyAnalysisLibrary)\n  target_link_libraries(MyAnalysisLibrary PUBLIC sparta::sparta)\n  ```\n\n## Issues\n\n\nIssues on GitHub are assigned priorities which reflect their urgency and how soon they are likely to be addressed.\n\n* P0: Unbreak now! A serious issue which should have someone working on it right now.\n* P1: High Priority. An important issue that someone should be actively working on.\n* P2: Mid Priority. An important issue which is in the queue to be processed soon.\n* P3: Low Priority. An important issue which may get dealt with at a later date.\n* P4: Wishlist. An issue with merit but low priority which is up for grabs but likely to be pruned if not addressed after a reasonable period.\n\n## License\n\nSPARTA is MIT-licensed, see the [LICENSE](LICENSE) file in the root directory of this source tree.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2FSPARTA","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebook%2FSPARTA","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2FSPARTA/lists"}