Skip to content

Commit 34bdc21

Browse files
doug-qss2165
andauthored
feat(tket2-hseries): Add tket2.wasm extension (#737)
Co-authored-by: Seyon Sivarajah <seyon.sivarajah@cambridgequantum.com>
1 parent 0c0b238 commit 34bdc21

File tree

6 files changed

+1214
-0
lines changed

6 files changed

+1214
-0
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 310 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,310 @@
1+
{
2+
"version": "0.1.0",
3+
"name": "tket2.wasm",
4+
"runtime_reqs": [
5+
"prelude",
6+
"tket2.futures"
7+
],
8+
"types": {
9+
"context": {
10+
"extension": "tket2.wasm",
11+
"name": "context",
12+
"params": [],
13+
"description": "wasm context",
14+
"bound": {
15+
"b": "Explicit",
16+
"bound": "A"
17+
}
18+
},
19+
"func": {
20+
"extension": "tket2.wasm",
21+
"name": "func",
22+
"params": [
23+
{
24+
"tp": "List",
25+
"param": {
26+
"tp": "Type",
27+
"b": "A"
28+
}
29+
},
30+
{
31+
"tp": "List",
32+
"param": {
33+
"tp": "Type",
34+
"b": "A"
35+
}
36+
}
37+
],
38+
"description": "wasm func",
39+
"bound": {
40+
"b": "Explicit",
41+
"bound": "C"
42+
}
43+
},
44+
"module": {
45+
"extension": "tket2.wasm",
46+
"name": "module",
47+
"params": [],
48+
"description": "wasm module",
49+
"bound": {
50+
"b": "Explicit",
51+
"bound": "C"
52+
}
53+
}
54+
},
55+
"values": {},
56+
"operations": {
57+
"call": {
58+
"extension": "tket2.wasm",
59+
"name": "call",
60+
"description": "call",
61+
"signature": {
62+
"params": [
63+
{
64+
"tp": "List",
65+
"param": {
66+
"tp": "Type",
67+
"b": "A"
68+
}
69+
},
70+
{
71+
"tp": "List",
72+
"param": {
73+
"tp": "Type",
74+
"b": "A"
75+
}
76+
}
77+
],
78+
"body": {
79+
"input": [
80+
{
81+
"t": "Opaque",
82+
"extension": "tket2.wasm",
83+
"id": "context",
84+
"args": [],
85+
"bound": "A"
86+
},
87+
{
88+
"t": "Opaque",
89+
"extension": "tket2.wasm",
90+
"id": "func",
91+
"args": [
92+
{
93+
"tya": "Sequence",
94+
"elems": [
95+
{
96+
"tya": "Variable",
97+
"idx": 0,
98+
"cached_decl": {
99+
"tp": "List",
100+
"param": {
101+
"tp": "Type",
102+
"b": "C"
103+
}
104+
}
105+
}
106+
]
107+
},
108+
{
109+
"tya": "Sequence",
110+
"elems": [
111+
{
112+
"tya": "Variable",
113+
"idx": 1,
114+
"cached_decl": {
115+
"tp": "List",
116+
"param": {
117+
"tp": "Type",
118+
"b": "C"
119+
}
120+
}
121+
}
122+
]
123+
}
124+
],
125+
"bound": "C"
126+
},
127+
{
128+
"t": "R",
129+
"i": 0,
130+
"b": "C"
131+
}
132+
],
133+
"output": [
134+
{
135+
"t": "Opaque",
136+
"extension": "tket2.wasm",
137+
"id": "context",
138+
"args": [],
139+
"bound": "A"
140+
},
141+
{
142+
"t": "Opaque",
143+
"extension": "tket2.futures",
144+
"id": "Future",
145+
"args": [
146+
{
147+
"tya": "Type",
148+
"ty": {
149+
"t": "Sum",
150+
"s": "General",
151+
"rows": [
152+
[
153+
{
154+
"t": "R",
155+
"i": 1,
156+
"b": "C"
157+
}
158+
]
159+
]
160+
}
161+
}
162+
],
163+
"bound": "A"
164+
}
165+
],
166+
"runtime_reqs": []
167+
}
168+
},
169+
"binary": false
170+
},
171+
"dispose_context": {
172+
"extension": "tket2.wasm",
173+
"name": "dispose_context",
174+
"description": "dispose_context",
175+
"signature": {
176+
"params": [],
177+
"body": {
178+
"input": [
179+
{
180+
"t": "Opaque",
181+
"extension": "tket2.wasm",
182+
"id": "context",
183+
"args": [],
184+
"bound": "A"
185+
}
186+
],
187+
"output": [],
188+
"runtime_reqs": []
189+
}
190+
},
191+
"binary": false
192+
},
193+
"get_context": {
194+
"extension": "tket2.wasm",
195+
"name": "get_context",
196+
"description": "get_context",
197+
"signature": {
198+
"params": [],
199+
"body": {
200+
"input": [
201+
{
202+
"t": "I"
203+
}
204+
],
205+
"output": [
206+
{
207+
"t": "Sum",
208+
"s": "General",
209+
"rows": [
210+
[],
211+
[
212+
{
213+
"t": "Opaque",
214+
"extension": "tket2.wasm",
215+
"id": "context",
216+
"args": [],
217+
"bound": "A"
218+
}
219+
]
220+
]
221+
}
222+
],
223+
"runtime_reqs": []
224+
}
225+
},
226+
"binary": false
227+
},
228+
"lookup": {
229+
"extension": "tket2.wasm",
230+
"name": "lookup",
231+
"description": "lookup",
232+
"signature": {
233+
"params": [
234+
{
235+
"tp": "String"
236+
},
237+
{
238+
"tp": "List",
239+
"param": {
240+
"tp": "Type",
241+
"b": "A"
242+
}
243+
},
244+
{
245+
"tp": "List",
246+
"param": {
247+
"tp": "Type",
248+
"b": "A"
249+
}
250+
}
251+
],
252+
"body": {
253+
"input": [
254+
{
255+
"t": "Opaque",
256+
"extension": "tket2.wasm",
257+
"id": "module",
258+
"args": [],
259+
"bound": "C"
260+
}
261+
],
262+
"output": [
263+
{
264+
"t": "Opaque",
265+
"extension": "tket2.wasm",
266+
"id": "func",
267+
"args": [
268+
{
269+
"tya": "Sequence",
270+
"elems": [
271+
{
272+
"tya": "Variable",
273+
"idx": 1,
274+
"cached_decl": {
275+
"tp": "List",
276+
"param": {
277+
"tp": "Type",
278+
"b": "C"
279+
}
280+
}
281+
}
282+
]
283+
},
284+
{
285+
"tya": "Sequence",
286+
"elems": [
287+
{
288+
"tya": "Variable",
289+
"idx": 2,
290+
"cached_decl": {
291+
"tp": "List",
292+
"param": {
293+
"tp": "Type",
294+
"b": "C"
295+
}
296+
}
297+
}
298+
]
299+
}
300+
],
301+
"bound": "C"
302+
}
303+
],
304+
"runtime_reqs": []
305+
}
306+
},
307+
"binary": false
308+
}
309+
}
310+
}

tket2-hseries/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ derive_more = { workspace = true, features = [
3939
"from",
4040
"into",
4141
] }
42+
typetag.workspace = true
4243
delegate.workspace = true
4344

4445
[dev-dependencies]

tket2-hseries/src/bin/tket2-hseries.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fn main() {
1313
tket2_hseries::extension::qsystem::EXTENSION.to_owned(),
1414
tket2_hseries::extension::futures::EXTENSION.to_owned(),
1515
tket2_hseries::extension::result::EXTENSION.to_owned(),
16+
tket2_hseries::extension::wasm::EXTENSION.to_owned(),
1617
]);
1718

1819
args.run_dump(&reg);

tket2-hseries/src/extension.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
pub mod futures;
33
pub mod qsystem;
44
pub mod result;
5+
pub mod wasm;

0 commit comments

Comments
 (0)