opensquirrel 0.0.6__py3-none-any.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.
- opensquirrel/__init__.py +3 -0
- opensquirrel/circuit.py +120 -0
- opensquirrel/circuit_builder.py +60 -0
- opensquirrel/circuit_matrix_calculator.py +30 -0
- opensquirrel/common.py +56 -0
- opensquirrel/default_gates.py +115 -0
- opensquirrel/gate_library.py +13 -0
- opensquirrel/mckay_decomposer.py +56 -0
- opensquirrel/merger.py +84 -0
- opensquirrel/parsing/__init__.py +0 -0
- opensquirrel/parsing/antlr/README.md +4 -0
- opensquirrel/parsing/antlr/__init__.py +0 -0
- opensquirrel/parsing/antlr/generated/CQasm3.interp +50 -0
- opensquirrel/parsing/antlr/generated/CQasm3.tokens +28 -0
- opensquirrel/parsing/antlr/generated/CQasm3Lexer.interp +68 -0
- opensquirrel/parsing/antlr/generated/CQasm3Lexer.py +1247 -0
- opensquirrel/parsing/antlr/generated/CQasm3Lexer.tokens +28 -0
- opensquirrel/parsing/antlr/generated/CQasm3Listener.py +101 -0
- opensquirrel/parsing/antlr/generated/CQasm3Parser.py +1350 -0
- opensquirrel/parsing/antlr/generated/CQasm3Visitor.py +58 -0
- opensquirrel/parsing/antlr/generated/CQasmLexer.interp +68 -0
- opensquirrel/parsing/antlr/generated/CQasmLexer.py +1247 -0
- opensquirrel/parsing/antlr/generated/CQasmLexer.tokens +28 -0
- opensquirrel/parsing/antlr/generated/README.md +4 -0
- opensquirrel/parsing/antlr/generated/__init__.py +0 -0
- opensquirrel/parsing/antlr/grammar/CQasm3.g4 +26 -0
- opensquirrel/parsing/antlr/grammar/__init__.py +0 -0
- opensquirrel/parsing/antlr/qubit_range_checker.py +66 -0
- opensquirrel/parsing/antlr/squirrel_error_handler.py +12 -0
- opensquirrel/parsing/antlr/squirrel_ir_creator.py +73 -0
- opensquirrel/parsing/antlr/squirrel_ir_from_string.py +56 -0
- opensquirrel/parsing/antlr/type_checker.py +75 -0
- opensquirrel/parsing/libqasm/README.md +3 -0
- opensquirrel/parsing/libqasm/__init__.py +0 -0
- opensquirrel/parsing/libqasm/libqasm_ir_creator.py +125 -0
- opensquirrel/replacer.py +92 -0
- opensquirrel/squirrel_ir.py +268 -0
- opensquirrel/utils/__init__.py +0 -0
- opensquirrel/utils/matrix_expander.py +185 -0
- opensquirrel/writer.py +37 -0
- opensquirrel-0.0.6.dist-info/LICENSE.md +201 -0
- opensquirrel-0.0.6.dist-info/METADATA +115 -0
- opensquirrel-0.0.6.dist-info/RECORD +44 -0
- opensquirrel-0.0.6.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
T__0=1
|
|
2
|
+
T__1=2
|
|
3
|
+
T__2=3
|
|
4
|
+
T__3=4
|
|
5
|
+
T__4=5
|
|
6
|
+
T__5=6
|
|
7
|
+
T__6=7
|
|
8
|
+
T__7=8
|
|
9
|
+
T__8=9
|
|
10
|
+
T__9=10
|
|
11
|
+
VERSION=11
|
|
12
|
+
ID=12
|
|
13
|
+
FLOAT=13
|
|
14
|
+
INT=14
|
|
15
|
+
WS=15
|
|
16
|
+
COMMENT=16
|
|
17
|
+
MULTILINE_COMMENT=17
|
|
18
|
+
';'=1
|
|
19
|
+
'\r\n'=2
|
|
20
|
+
'\n'=3
|
|
21
|
+
'3.0'=4
|
|
22
|
+
'qubit['=5
|
|
23
|
+
']'=6
|
|
24
|
+
','=7
|
|
25
|
+
'['=8
|
|
26
|
+
':'=9
|
|
27
|
+
'-'=10
|
|
28
|
+
'version'=11
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Generated from CQasm3.g4 by ANTLR 4.13.1
|
|
2
|
+
from antlr4 import *
|
|
3
|
+
|
|
4
|
+
if "." in __name__:
|
|
5
|
+
from .CQasm3Parser import CQasm3Parser
|
|
6
|
+
else:
|
|
7
|
+
from CQasm3Parser import CQasm3Parser
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# This class defines a complete listener for a parse tree produced by CQasm3Parser.
|
|
11
|
+
class CQasm3Listener(ParseTreeListener):
|
|
12
|
+
# Enter a parse tree produced by CQasm3Parser#stateSep.
|
|
13
|
+
def enterStateSep(self, ctx: CQasm3Parser.StateSepContext):
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
# Exit a parse tree produced by CQasm3Parser#stateSep.
|
|
17
|
+
def exitStateSep(self, ctx: CQasm3Parser.StateSepContext):
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
# Enter a parse tree produced by CQasm3Parser#prog.
|
|
21
|
+
def enterProg(self, ctx: CQasm3Parser.ProgContext):
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
# Exit a parse tree produced by CQasm3Parser#prog.
|
|
25
|
+
def exitProg(self, ctx: CQasm3Parser.ProgContext):
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
# Enter a parse tree produced by CQasm3Parser#qubitRegisterDeclaration.
|
|
29
|
+
def enterQubitRegisterDeclaration(self, ctx: CQasm3Parser.QubitRegisterDeclarationContext):
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
# Exit a parse tree produced by CQasm3Parser#qubitRegisterDeclaration.
|
|
33
|
+
def exitQubitRegisterDeclaration(self, ctx: CQasm3Parser.QubitRegisterDeclarationContext):
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
# Enter a parse tree produced by CQasm3Parser#gateApplication.
|
|
37
|
+
def enterGateApplication(self, ctx: CQasm3Parser.GateApplicationContext):
|
|
38
|
+
pass
|
|
39
|
+
|
|
40
|
+
# Exit a parse tree produced by CQasm3Parser#gateApplication.
|
|
41
|
+
def exitGateApplication(self, ctx: CQasm3Parser.GateApplicationContext):
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
# Enter a parse tree produced by CQasm3Parser#Qubit.
|
|
45
|
+
def enterQubit(self, ctx: CQasm3Parser.QubitContext):
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
# Exit a parse tree produced by CQasm3Parser#Qubit.
|
|
49
|
+
def exitQubit(self, ctx: CQasm3Parser.QubitContext):
|
|
50
|
+
pass
|
|
51
|
+
|
|
52
|
+
# Enter a parse tree produced by CQasm3Parser#Qubits.
|
|
53
|
+
def enterQubits(self, ctx: CQasm3Parser.QubitsContext):
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
# Exit a parse tree produced by CQasm3Parser#Qubits.
|
|
57
|
+
def exitQubits(self, ctx: CQasm3Parser.QubitsContext):
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
# Enter a parse tree produced by CQasm3Parser#QubitRange.
|
|
61
|
+
def enterQubitRange(self, ctx: CQasm3Parser.QubitRangeContext):
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
# Exit a parse tree produced by CQasm3Parser#QubitRange.
|
|
65
|
+
def exitQubitRange(self, ctx: CQasm3Parser.QubitRangeContext):
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
# Enter a parse tree produced by CQasm3Parser#IntLiteral.
|
|
69
|
+
def enterIntLiteral(self, ctx: CQasm3Parser.IntLiteralContext):
|
|
70
|
+
pass
|
|
71
|
+
|
|
72
|
+
# Exit a parse tree produced by CQasm3Parser#IntLiteral.
|
|
73
|
+
def exitIntLiteral(self, ctx: CQasm3Parser.IntLiteralContext):
|
|
74
|
+
pass
|
|
75
|
+
|
|
76
|
+
# Enter a parse tree produced by CQasm3Parser#NegatedIntLiteral.
|
|
77
|
+
def enterNegatedIntLiteral(self, ctx: CQasm3Parser.NegatedIntLiteralContext):
|
|
78
|
+
pass
|
|
79
|
+
|
|
80
|
+
# Exit a parse tree produced by CQasm3Parser#NegatedIntLiteral.
|
|
81
|
+
def exitNegatedIntLiteral(self, ctx: CQasm3Parser.NegatedIntLiteralContext):
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
# Enter a parse tree produced by CQasm3Parser#FloatLiteral.
|
|
85
|
+
def enterFloatLiteral(self, ctx: CQasm3Parser.FloatLiteralContext):
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
# Exit a parse tree produced by CQasm3Parser#FloatLiteral.
|
|
89
|
+
def exitFloatLiteral(self, ctx: CQasm3Parser.FloatLiteralContext):
|
|
90
|
+
pass
|
|
91
|
+
|
|
92
|
+
# Enter a parse tree produced by CQasm3Parser#NegatedFloatLiteral.
|
|
93
|
+
def enterNegatedFloatLiteral(self, ctx: CQasm3Parser.NegatedFloatLiteralContext):
|
|
94
|
+
pass
|
|
95
|
+
|
|
96
|
+
# Exit a parse tree produced by CQasm3Parser#NegatedFloatLiteral.
|
|
97
|
+
def exitNegatedFloatLiteral(self, ctx: CQasm3Parser.NegatedFloatLiteralContext):
|
|
98
|
+
pass
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
del CQasm3Parser
|