Skip to content


Repository files navigation


Version 3.5 - xx February 2024

GitHub actions


staq is a modern C++ library for the synthesis, transformation, optimization and compilation of quantum circuits. staq is written in standard C++17 and has very low external dependencies. It is usable either through the provided binary tools, or as a header-only library that can be included to provide direct support for parsing & manipulating circuits written in the OpenQASM 2.0 circuit description language.

Inspired by Clang, staq is designed to manipulate OpenQASM 2.0 syntax trees directly, rather than through an intermediate representation which makes retrieving the original source code impossible. In particular, OpenQASM 2.0 circuits can be inspected and transformed (in most cases) without losing the original source structure. This makes staq ideally suited for source-to-source transformations, where only specific changes are desired. Likewise, this allows translations to other common circuit description languages and libraries to closely follow the OpenQASM 2.0 source.

Check out the Wiki for more information about the library and included tools.

Copyright (c) 2013 - 2024 softwareQ Inc. All rights reserved.


staq is distributed under the MIT license. Please see the LICENSE file for more details.

Installation instructions

Please see the installation guide and the comprehensive Wiki for further documentation and detailed examples.

Python 3 wrapper

pystaq is a Python 3 wrapper for staq. pystaq can be installed using pip

pip install git+

For more details, please see pystaq/


Thanks to the excellent EPFL logic synthesis libraries which are used to perform logic synthesis in staq, and in particular Bruno Schmitt's tweedledum library, from which the OpenQASM 2.0 parser was adapted.