https://github.com/softwareqinc/qasm3tools
OpenQASM 3.0 parser
https://github.com/softwareqinc/qasm3tools
Last synced: about 1 year ago
JSON representation
OpenQASM 3.0 parser
- Host: GitHub
- URL: https://github.com/softwareqinc/qasm3tools
- Owner: softwareQinc
- License: mit
- Created: 2021-10-18T12:54:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-24T15:01:58.000Z (over 1 year ago)
- Last Synced: 2025-04-07T17:51:58.533Z (about 1 year ago)
- Language: C++
- Size: 4.78 MB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# qasm3tools
[](https://github.com/softwareQinc/qasm3tools/actions)
---
## Setup
```shell
cmake -B build
cmake --build build --parallel 8
```
This creates the `parser` executable.
```shell
./parser /path/to/circuit.qasm
```
---
## Interpreter
To build the interpreter, you must
have [qpp](https://github.com/softwareQinc/qpp) installed.
Execute
```shell
cmake -B build -DWITH_INTERPRETER=ON
cmake --build build --parallel 8
```
This creates the `interpreter` executable. Usage:
```shell
./interpreter /path/to/circuit.qasm
```
If the OpenQASM 3.0 file contains `n` input variables, then the interpreter
requires exactly `n` additional commandline arguments to specify their values.
For example, if the file contains
```
input float[32] fl;
input bool bl;
```
Then it could be executed with
```shell
./interpreter example.qasm "pi/2" "true"
```
---
## Unit testing
```shell
cmake --build build --target unit_tests --parallel 8
ctest --test-dir build
```
---
## Notes
1. The interpreter is implemented to *exclude* the endpoints of ranges. As of
August 10, 2022, in the OpenQASM 3.0 live specification, range endpoints are
included.
2. The OpenQASM 3.0 standard library defines the `u3` and `u2` gates differently
than the Qiskit specifications.
| Gate | OpenQASM 3.0 | Qiskit | Phase inconsistency |
|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
| u3 |  |  |  |
| u2 |  |  |  |