libqasm 0.5.2__cp311-cp311-macosx_10_10_universal2.whl → 0.6.1__cp311-cp311-macosx_10_10_universal2.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/v3x/ast.py +7407 -2186
- cqasm/v3x/primitives.py +4 -25
- cqasm/v3x/semantic.py +231 -522
- cqasm/v3x/types.py +75 -1150
- cqasm/v3x/values.py +78 -973
- libQasm/_libQasm.cpython-311-darwin.so +0 -0
- libQasm/libQasm.py +14 -705
- {libqasm-0.5.2.dist-info → libqasm-0.6.1.dist-info}/METADATA +37 -48
- libqasm-0.6.1.dist-info/RECORD +16 -0
- {libqasm-0.5.2.dist-info → libqasm-0.6.1.dist-info}/WHEEL +1 -1
- cqasm/v1x/__init__.py +0 -65
- cqasm/v1x/ast.py +0 -14966
- cqasm/v1x/error_model.py +0 -41
- cqasm/v1x/instruction.py +0 -70
- cqasm/v1x/primitives.py +0 -177
- cqasm/v1x/semantic.py +0 -7214
- cqasm/v1x/types.py +0 -2414
- cqasm/v1x/values.py +0 -3200
- libqasm-0.5.2.dist-info/RECORD +0 -24
- {libqasm-0.5.2.dist-info → libqasm-0.6.1.dist-info}/LICENSE.md +0 -0
- {libqasm-0.5.2.dist-info → libqasm-0.6.1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: libqasm
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.6.1
|
4
4
|
Summary: libQasm Python Package
|
5
5
|
Home-page: https://github.com/QuTech-Delft/libqasm
|
6
6
|
Author: QuTech, TU Delft
|
@@ -9,48 +9,38 @@ Classifier: Operating System :: POSIX :: Linux
|
|
9
9
|
Classifier: Operating System :: MacOS
|
10
10
|
Classifier: Operating System :: Microsoft :: Windows
|
11
11
|
Classifier: Programming Language :: Python :: 3 :: Only
|
12
|
-
Classifier: Programming Language :: Python :: 3.5
|
13
|
-
Classifier: Programming Language :: Python :: 3.6
|
14
|
-
Classifier: Programming Language :: Python :: 3.7
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
16
12
|
Classifier: Topic :: Scientific/Engineering
|
17
13
|
Description-Content-Type: text/markdown
|
18
14
|
License-File: LICENSE.md
|
19
15
|
Requires-Dist: numpy
|
20
16
|
|
21
|
-
# libQASM: Library to parse cQASM
|
17
|
+
# libQASM: Library to parse cQASM v3.0 files
|
22
18
|
|
23
19
|
[](https://github.com/qutech-delft/libqasm/actions)
|
24
20
|
[](https://pypi.org/project/libqasm/)
|
25
|
-
[](https://anaconda.org/qutech/libqasm/)
|
26
|
-
[](https://libqasm.readthedocs.io/en/latest/)
|
27
21
|
|
28
22
|
## File organization
|
29
23
|
|
30
|
-
|
31
|
-
Please note however that the language has changed to some degree since then,
|
32
|
-
and the `qasm.bnf` has never fully corresponded with the flex/bison grammar.
|
24
|
+
For development, see:
|
33
25
|
|
34
|
-
|
35
|
-
|
36
|
-
|
26
|
+
- `include`: public headers.
|
27
|
+
- `src`: source files.
|
28
|
+
- `test`: test files.
|
29
|
+
- `python`: SWIG interface.
|
30
|
+
- `res`: resource files, for testing.
|
37
31
|
|
38
|
-
|
39
|
-
- `include/v1x`: headers of the new API.
|
40
|
-
- `include/v10`: compatibility layer for the original API, now built on top of the new API instead of the original flex/bison parser.
|
41
|
-
- `test/v1x`: tests for the new API.
|
42
|
-
- `test/v10`: tests for the original API, as well as its Python bindings.
|
32
|
+
For build process, continuous integration, and documentation:
|
43
33
|
|
44
|
-
|
34
|
+
- `conan`: Conan profiles.
|
35
|
+
- `emscripten`: bindings and test for the emscripten binaries.
|
36
|
+
- `scripts`: helper scripts used during the build process.
|
37
|
+
- `.github`: GitHub Actions configuration files.
|
38
|
+
- `doc`: documentation.
|
45
39
|
|
46
|
-
|
47
|
-
- `pybuild`: the Python library output files generated by `setup.py`.
|
48
|
-
|
49
|
-
### WIP: cQASM v3.0
|
40
|
+
Build outputs may go into:
|
50
41
|
|
51
|
-
|
52
|
-
|
53
|
-
However, the development of the new parser is still in a very early stage so its use through the API is completely unsupported.
|
42
|
+
- `build/<build type>`: the C++ library output files generated by Conan.
|
43
|
+
- `pybuild`: the Python library output files generated by `setup.py`.
|
54
44
|
|
55
45
|
## Dependencies
|
56
46
|
|
@@ -62,12 +52,10 @@ However, the development of the new parser is still in a very early stage so its
|
|
62
52
|
|
63
53
|
### ARM specific dependencies
|
64
54
|
|
65
|
-
We are having problems when using the `
|
66
|
-
`
|
67
|
-
So, for the time being, we are installing
|
55
|
+
We are having problems when using the `zulu-opendjk` Conan package on an ARMv8 architecture.
|
56
|
+
`zulu-openjdk` provides the Java JRE required by the ANTLR generator.
|
57
|
+
So, for the time being, we are installing Java manually for this platform.
|
68
58
|
|
69
|
-
* `Flex` >= 2.6.4
|
70
|
-
* `Bison` >= 3.0
|
71
59
|
* `Java JRE` >= 11
|
72
60
|
|
73
61
|
## Build
|
@@ -81,7 +69,7 @@ The installation of dependencies, as well as the compilation, can be done in one
|
|
81
69
|
git clone https://github.com/QuTech-Delft/libqasm.git
|
82
70
|
cd libqasm
|
83
71
|
conan profile detect
|
84
|
-
conan build . -pr=conan/profiles/tests-debug -b missing
|
72
|
+
conan build . -pr:a=conan/profiles/tests-debug -b missing
|
85
73
|
```
|
86
74
|
|
87
75
|
Notice:
|
@@ -104,16 +92,14 @@ All the profiles set the C++ standard to 20. All the `tests` profiles enable Add
|
|
104
92
|
Profiles are a shorthand for command line options. The command above could be written as well as:
|
105
93
|
|
106
94
|
```
|
107
|
-
conan build . -s:h compiler.cppstd=20 -s:h libqasm/*:build_type=Debug -o libqasm/*:
|
95
|
+
conan build . -s:h compiler.cppstd=20 -s:h libqasm/*:build_type=Debug -o libqasm/*:build_tests=True -o libqasm/*:asan_enabled=True -b missing
|
108
96
|
```
|
109
97
|
|
110
98
|
These are the list of options that could be specified whether in a profile or in the command line:
|
111
99
|
|
100
|
+
- `libqasm/*:asan_enabled={True,False}`: enables Address Sanitizer.
|
112
101
|
- `libqasm/*:build_tests={True,False}`: builds tests or not.
|
113
102
|
- `libqasm/*:build_type={Debug,Release}`: builds in debug or release mode.
|
114
|
-
- `libqasm/*:asan_enabled={True,False}`: enables Address Sanitizer.
|
115
|
-
- `libqasm/*:compat={True,False}`: enables installation of the headers for the original API,
|
116
|
-
on top of the ones for the new API.
|
117
103
|
- `libqasm/*:shared={True,False}`: builds a shared object library instead of a static library, if applicable.
|
118
104
|
|
119
105
|
## Install
|
@@ -126,13 +112,6 @@ Install from the project root directory as follows:
|
|
126
112
|
python3 -m pip install --verbose .
|
127
113
|
```
|
128
114
|
|
129
|
-
or if you'd rather use conda:
|
130
|
-
|
131
|
-
```
|
132
|
-
conda build python/conda
|
133
|
-
conda install libqasm --use-local
|
134
|
-
```
|
135
|
-
|
136
115
|
You can test if it works by running:
|
137
116
|
|
138
117
|
```
|
@@ -144,7 +123,7 @@ python3 -m pytest
|
|
144
123
|
The `CMakeLists.txt` file in the root directory includes install targets:
|
145
124
|
|
146
125
|
```
|
147
|
-
conan create --version 0.
|
126
|
+
conan create --version 0.5.2 . -pr=tests-debug -b missing
|
148
127
|
```
|
149
128
|
|
150
129
|
You can test if it works by doing:
|
@@ -176,10 +155,8 @@ target_include_directories(<your target> SYSTEM PRIVATE "${cqasm_SOURCE_DIR}/inc
|
|
176
155
|
target_link_libraries(<your target> PUBLIC cqasm)
|
177
156
|
```
|
178
157
|
|
179
|
-
Note that the following
|
158
|
+
Note that the following dependency is required for `libqasm` to build:
|
180
159
|
|
181
|
-
* `Flex` >= 2.6.4
|
182
|
-
* `Bison` >= 3.0
|
183
160
|
* `Java JRE` >= 11
|
184
161
|
|
185
162
|
The original API headers are *not* included by default.
|
@@ -199,3 +176,15 @@ If you are having trouble with this just create new clone of this repository usi
|
|
199
176
|
```
|
200
177
|
git clone --config core.autocrlf=input git@github.com:QuTech-Delft/libqasm.git
|
201
178
|
```
|
179
|
+
|
180
|
+
## Emscripten
|
181
|
+
|
182
|
+
The generation of emscripten binaries has been tested as a cross-compilation from an ubuntu/x64 platform.
|
183
|
+
|
184
|
+
```
|
185
|
+
conan build . -pr=conan/profiles/emscripten -pr:b=conan/profiles/release -b missing
|
186
|
+
```
|
187
|
+
|
188
|
+
The output of this build lives in `build/Release/emscripten`:
|
189
|
+
- `cqasm_emscripten.js`.
|
190
|
+
- `cqasm_emscripten.wasm`.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
cqasm/__init__.py,sha256=MsSFjiLMLJZ7QhUPpVBWKiyDnCzryquRyr329NoCACI,2
|
2
|
+
cqasm/v3x/__init__.py,sha256=vZyVREhVeJdxipgSMSHGhKfyg70x1ISKn1v2bFO2734,2785
|
3
|
+
cqasm/v3x/ast.py,sha256=bo4yd7N9LMdvo63xNF1kfm_xpdZ74y9B6wQ3URmV0J0,412186
|
4
|
+
cqasm/v3x/instruction.py,sha256=AEOwKV2riafpyTiJvgq7azwOhyhhZfpKV12uWWJ5M2A,1177
|
5
|
+
cqasm/v3x/primitives.py,sha256=ESCsMHP1GeuKh2gHQSP0ha24Abp453U-I7JSGK9dZas,1664
|
6
|
+
cqasm/v3x/semantic.py,sha256=8zWB24LKxPymLW4lPgxmURGol2LXh7mqBKtZWo1GNKs,86535
|
7
|
+
cqasm/v3x/types.py,sha256=NBp3uh23nnGNzKHtOrJBafDJ2wKqhQJ5eJSJtsr0uMk,51593
|
8
|
+
cqasm/v3x/values.py,sha256=YY_41YQ7iU2te7FqtstGnQJd4W3CFH7LmkawSKh5e_A,61680
|
9
|
+
libQasm/__init__.py,sha256=qxoyhS4wo8oA5cwO4IIbrLuCHztOJAT2MrpCOR2mSF4,727
|
10
|
+
libQasm/_libQasm.cpython-311-darwin.so,sha256=CODVlnyi06Ew1KhEpOg_lTS77uScdk7gomU1eLf6f2o,4124320
|
11
|
+
libQasm/libQasm.py,sha256=hzX-iSOvyoM2FBHbKvvol76Mt1lS2F3FweDm37Y-3RM,30595
|
12
|
+
libqasm-0.6.1.dist-info/LICENSE.md,sha256=duRlJgy46W8Cw_IQjOmud5xJUvgJkX6pkBmBJkoKi4I,566
|
13
|
+
libqasm-0.6.1.dist-info/METADATA,sha256=WUEIXx7Eg87TjR5_nhpinoZabjgveZU129_d1QZAXxc,5913
|
14
|
+
libqasm-0.6.1.dist-info/WHEEL,sha256=4F58ZCesPOUjwzTHMKuwuydHHOQLmBKJtTM5AtvBHqQ,116
|
15
|
+
libqasm-0.6.1.dist-info/top_level.txt,sha256=w7QwYbOjqjU8FE8PSUGSKMILn4kqQEJWKNLvab5ehEg,14
|
16
|
+
libqasm-0.6.1.dist-info/RECORD,,
|
cqasm/v1x/__init__.py
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
import cqasm.v1x.ast as ast
|
2
|
-
import cqasm.v1x.semantic as semantic
|
3
|
-
import libQasm
|
4
|
-
|
5
|
-
|
6
|
-
class Analyzer(libQasm.V1xAnalyzer):
|
7
|
-
# parse_file and parse_string are static methods because they do not change the status of the analyzer
|
8
|
-
# Instead, they just invoke free functions that create a temporary instance of a parser
|
9
|
-
# analyze_file and analyze_string are not static methods because they change the status of the analyzer
|
10
|
-
|
11
|
-
# parse_file, parse_string, analyze_file, and analyze_string return a vector of strings
|
12
|
-
# If the length of the vector is 1, the string is a serialization of the AST
|
13
|
-
# Otherwise, it is a list of errors
|
14
|
-
|
15
|
-
@staticmethod
|
16
|
-
def parse_file(*args):
|
17
|
-
ret = libQasm.V1xAnalyzer.parse_file(*args)
|
18
|
-
if len(ret) == 1:
|
19
|
-
serialized_ast_str = str(ret[0])
|
20
|
-
serialized_ast_bytes = serialized_ast_str.encode(encoding='utf-8', errors="surrogateescape")
|
21
|
-
deserialized_ast = ast.Root.deserialize(serialized_ast_bytes)
|
22
|
-
return deserialized_ast
|
23
|
-
return [str(error) for error in ret[1:]]
|
24
|
-
|
25
|
-
@staticmethod
|
26
|
-
def parse_string(*args):
|
27
|
-
ret = libQasm.V1xAnalyzer.parse_string(*args)
|
28
|
-
if len(ret) == 1:
|
29
|
-
serialized_ast_str = str(ret[0])
|
30
|
-
serialized_ast_bytes = serialized_ast_str.encode(encoding='utf-8', errors="surrogateescape")
|
31
|
-
deserialized_ast = ast.Root.deserialize(serialized_ast_bytes)
|
32
|
-
return deserialized_ast
|
33
|
-
return [str(error) for error in ret[1:]]
|
34
|
-
|
35
|
-
def analyze_file(self, *args):
|
36
|
-
ret = super().analyze_file(*args)
|
37
|
-
if len(ret) == 1:
|
38
|
-
serialized_ast_str = str(ret[0])
|
39
|
-
serialized_ast_bytes = serialized_ast_str.encode(encoding='utf-8', errors="surrogateescape")
|
40
|
-
deserialized_ast = semantic.Program.deserialize(serialized_ast_bytes)
|
41
|
-
return deserialized_ast
|
42
|
-
return [str(error) for error in ret[1:]]
|
43
|
-
|
44
|
-
def analyze_string(self, *args):
|
45
|
-
ret = super().analyze_string(*args)
|
46
|
-
if len(ret) == 1:
|
47
|
-
serialized_ast_str = str(ret[0])
|
48
|
-
serialized_ast_bytes = serialized_ast_str.encode(encoding='utf-8', errors="surrogateescape")
|
49
|
-
deserialized_ast = semantic.Program.deserialize(serialized_ast_bytes)
|
50
|
-
return deserialized_ast
|
51
|
-
return [str(error) for error in ret[1:]]
|
52
|
-
|
53
|
-
@staticmethod
|
54
|
-
def parse_file_to_json(*args):
|
55
|
-
return libQasm.V1xAnalyzer.parse_file_to_json(*args)
|
56
|
-
|
57
|
-
@staticmethod
|
58
|
-
def parse_string_to_json(*args):
|
59
|
-
return libQasm.V1xAnalyzer.parse_string_to_json(*args)
|
60
|
-
|
61
|
-
def analyze_file_to_json(self, *args):
|
62
|
-
return super().analyze_file_to_json(*args)
|
63
|
-
|
64
|
-
def analyze_string_to_json(self, *args):
|
65
|
-
return super().analyze_string_to_json(*args)
|