libqasm 0.6.7__cp311-cp311-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cqasm/__init__.py +1 -0
- cqasm/v3x/__init__.py +114 -0
- cqasm/v3x/ast.py +11261 -0
- cqasm/v3x/instruction.py +42 -0
- cqasm/v3x/primitives.py +72 -0
- cqasm/v3x/semantic.py +2367 -0
- cqasm/v3x/types.py +1742 -0
- cqasm/v3x/values.py +1714 -0
- libqasm/__init__.py +25 -0
- libqasm/_libqasm.cpython-311-darwin.so +0 -0
- libqasm/libqasm.py +1082 -0
- libqasm-0.6.7.dist-info/LICENSE.md +13 -0
- libqasm-0.6.7.dist-info/METADATA +127 -0
- libqasm-0.6.7.dist-info/RECORD +16 -0
- libqasm-0.6.7.dist-info/WHEEL +5 -0
- libqasm-0.6.7.dist-info/top_level.txt +2 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright [2018] [QCA Lab, QuTech, TU Delft]
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
@@ -0,0 +1,127 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: libqasm
|
3
|
+
Version: 0.6.7
|
4
|
+
Summary: libqasm Python Package
|
5
|
+
Home-page: https://github.com/QuTech-Delft/libqasm
|
6
|
+
Author: QuTech, TU Delft
|
7
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
8
|
+
Classifier: Operating System :: POSIX :: Linux
|
9
|
+
Classifier: Operating System :: MacOS
|
10
|
+
Classifier: Operating System :: Microsoft :: Windows
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
16
|
+
Classifier: Topic :: Scientific/Engineering
|
17
|
+
Description-Content-Type: text/markdown
|
18
|
+
License-File: LICENSE.md
|
19
|
+
Requires-Dist: numpy
|
20
|
+
|
21
|
+
# libQASM
|
22
|
+
|
23
|
+
[](https://github.com/qutech-delft/libqasm/actions)
|
24
|
+
[](https://conan.io/center/recipes/libqasm)
|
25
|
+
[](https://pypi.org/project/libqasm/)
|
26
|
+

|
27
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
28
|
+
|
29
|
+
libQASM is a library to parse programs written in the cQASM quantum programming language, developed by QuTech.
|
30
|
+
At the moment, libQASM only supports cQASM v3.0 programs.
|
31
|
+
|
32
|
+
It performs lexical, syntactic, and semantic analysis of an input program received via a file or a string.
|
33
|
+
It produces one of the following results:
|
34
|
+
|
35
|
+
- A syntactic or semantic AST (Abstract Syntax Tree) object. Depending on if we are parsing or analysing.
|
36
|
+
- A list of parsing or analysing errors. In case the input program was malformed.
|
37
|
+
- A JSON representation of either the AST or the list of errors.
|
38
|
+
|
39
|
+
It can be used within:
|
40
|
+
|
41
|
+
- C++ projects (as a [Conan package](https://conan.io/center/recipes/libqasm)).
|
42
|
+
- Python projects (as a [Python package](https://pypi.org/project/libqasm/)).
|
43
|
+
- Emscripten projects (via a Typescript frontend).
|
44
|
+
|
45
|
+
Check out [QX simulator](https://github.com/QuTech-Delft/qx-simulator)
|
46
|
+
and [OpenSquirrel](https://github.com/QuTech-Delft/OpenSquirrel) compiler
|
47
|
+
for an example of use in a C++ and a Python project, respectively.
|
48
|
+
|
49
|
+
## Getting started
|
50
|
+
|
51
|
+
Given a cQASM program `example.cq`.
|
52
|
+
|
53
|
+
```cQASM
|
54
|
+
version 3.0
|
55
|
+
|
56
|
+
qubit[2] q
|
57
|
+
bit[2] b
|
58
|
+
|
59
|
+
H q[0]
|
60
|
+
CNOT q[0], q[1]
|
61
|
+
b = measure q
|
62
|
+
```
|
63
|
+
|
64
|
+
We can parse or analyze this circuit, using libQASM through the following programming language:
|
65
|
+
|
66
|
+
### C++
|
67
|
+
|
68
|
+
```cpp
|
69
|
+
#include "v3/cqasm-py.hpp"
|
70
|
+
|
71
|
+
int main() {
|
72
|
+
auto parse_result = V3xAnalyzer::parse_file("example.cq");
|
73
|
+
|
74
|
+
auto analyzer = V3xAnalyzer();
|
75
|
+
auto analysis_result = analyzer.analyze_file("example.cq");
|
76
|
+
}
|
77
|
+
```
|
78
|
+
|
79
|
+
|
80
|
+
### Emscripten
|
81
|
+
|
82
|
+
The emscripten API only allows to input a cQASM program as a string.
|
83
|
+
|
84
|
+
```typescript
|
85
|
+
import { default as wrapper } from 'cqasm_emscripten.mjs';
|
86
|
+
|
87
|
+
wrapper().then(function(result: any) {
|
88
|
+
let analyzer = new result["EmscriptenWrapper"]()
|
89
|
+
let program = `
|
90
|
+
version 3
|
91
|
+
qubit[2] q
|
92
|
+
bit[2] b
|
93
|
+
H q[0]
|
94
|
+
CNOT q[0], q[1]
|
95
|
+
b = measure q
|
96
|
+
`
|
97
|
+
let output = analyzer.parse_string_to_json(program)
|
98
|
+
analyzer.delete()
|
99
|
+
}).catch((error: any) => {
|
100
|
+
console.error("unhandledRejection", error, "\n");
|
101
|
+
});
|
102
|
+
```
|
103
|
+
|
104
|
+
### Python
|
105
|
+
|
106
|
+
```python
|
107
|
+
from libqasm import Analyzer
|
108
|
+
|
109
|
+
if __name__ == "__main__":
|
110
|
+
parse_result = Analyzer.parse_file('example.cq')
|
111
|
+
|
112
|
+
analyzer = Analyzer()
|
113
|
+
analysis_result = analyzer.analyze_file('example.cq')
|
114
|
+
```
|
115
|
+
|
116
|
+
## Documentation
|
117
|
+
|
118
|
+
The [libQASM documentation](https://QuTech-Delft.github.io/libqasm/) is hosted through GitHub Pages.
|
119
|
+
|
120
|
+
## License
|
121
|
+
|
122
|
+
libQASM is licensed under the Apache License, Version 2.0.
|
123
|
+
See [LICENSE](https://github.com/QuTech-Delft/libqasm/blob/master/LICENSE.md) for the full license text.
|
124
|
+
|
125
|
+
## Authors
|
126
|
+
|
127
|
+
Quantum Inspire: [support@quantum-inspire.com](mailto:"support@quantum-inspire.com")
|
@@ -0,0 +1,16 @@
|
|
1
|
+
cqasm/__init__.py,sha256=MsSFjiLMLJZ7QhUPpVBWKiyDnCzryquRyr329NoCACI,2
|
2
|
+
cqasm/v3x/values.py,sha256=YY_41YQ7iU2te7FqtstGnQJd4W3CFH7LmkawSKh5e_A,61680
|
3
|
+
cqasm/v3x/semantic.py,sha256=7JB7EU2QL6m4LZC8uPp-giGVRUa_RwKzlci1PA4LRIg,86312
|
4
|
+
cqasm/v3x/primitives.py,sha256=aB-srIVOWSAmEWfmDk9-kHgKqTcvHQzSXCfCivUj4ic,2038
|
5
|
+
cqasm/v3x/__init__.py,sha256=ZdGtSG6X-2byUSxg89qW6QM0eD2gI8Vy3ZruFSxVa5c,4776
|
6
|
+
cqasm/v3x/types.py,sha256=izXYdNmYvJUcRSZVLJ-blPnU2TmhOGR1Z3Rhtk8rTOQ,63328
|
7
|
+
cqasm/v3x/ast.py,sha256=6ywaD-iRbJJZY_NXsTSSln2cvxA56mpp6stvKg-fLzo,420404
|
8
|
+
cqasm/v3x/instruction.py,sha256=AEOwKV2riafpyTiJvgq7azwOhyhhZfpKV12uWWJ5M2A,1177
|
9
|
+
libqasm-0.6.7.dist-info/LICENSE.md,sha256=duRlJgy46W8Cw_IQjOmud5xJUvgJkX6pkBmBJkoKi4I,566
|
10
|
+
libqasm-0.6.7.dist-info/RECORD,,
|
11
|
+
libqasm-0.6.7.dist-info/WHEEL,sha256=GtUMBD8rRNN-RJptdWLtqVb-pAPV69bWaMPIs5zM-s8,109
|
12
|
+
libqasm-0.6.7.dist-info/top_level.txt,sha256=iZ8PSLyg3lJwvSUCvWE8VCJGU-nmQY2YIrbMe7M7kLw,14
|
13
|
+
libqasm-0.6.7.dist-info/METADATA,sha256=-kdFhKv4um7dFYC7d0Gvn42J_bWgLIXlwTj1Ql4ELYE,3967
|
14
|
+
libqasm/__init__.py,sha256=liVJFi24VHbmUU-9lBA6hm-xPpF1DgzXMsZ0f1dqO3E,727
|
15
|
+
libqasm/_libqasm.cpython-311-darwin.so,sha256=m6-hUhnIk_dhk_4Yhf6XOOR7ATLp0TGwjUwq9ZiHBM0,4015608
|
16
|
+
libqasm/libqasm.py,sha256=io7NCBJdhdoguyRWGAWCKjc4fQnLL9Wngta4a9MXM9M,30595
|