gram-frame 0.1.8__tar.gz

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.
@@ -0,0 +1,4 @@
1
+ # Spans in the conformance corpus are byte offsets, so its files must be checked out byte for byte. A Windows checkout
2
+ # that converts line endings to CRLF shifts every span after the first line (it failed the Windows wheel's corpus run).
3
+ *.gram text eol=lf
4
+ conformance/** -text
@@ -0,0 +1,7 @@
1
+ target/
2
+
3
+ # Dependencies and bytecode from the spike scripts
4
+ node_modules/
5
+ __pycache__/
6
+ *.pyc
7
+ dist/
@@ -0,0 +1,486 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 3
4
+
5
+ [[package]]
6
+ name = "aho-corasick"
7
+ version = "1.1.5"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
10
+ dependencies = [
11
+ "memchr",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "anstream"
16
+ version = "1.0.0"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d"
19
+ dependencies = [
20
+ "anstyle",
21
+ "anstyle-parse",
22
+ "anstyle-query",
23
+ "anstyle-wincon",
24
+ "colorchoice",
25
+ "is_terminal_polyfill",
26
+ "utf8parse",
27
+ ]
28
+
29
+ [[package]]
30
+ name = "anstyle"
31
+ version = "1.0.14"
32
+ source = "registry+https://github.com/rust-lang/crates.io-index"
33
+ checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000"
34
+
35
+ [[package]]
36
+ name = "anstyle-parse"
37
+ version = "1.0.0"
38
+ source = "registry+https://github.com/rust-lang/crates.io-index"
39
+ checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e"
40
+ dependencies = [
41
+ "utf8parse",
42
+ ]
43
+
44
+ [[package]]
45
+ name = "anstyle-query"
46
+ version = "1.1.5"
47
+ source = "registry+https://github.com/rust-lang/crates.io-index"
48
+ checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc"
49
+ dependencies = [
50
+ "windows-sys",
51
+ ]
52
+
53
+ [[package]]
54
+ name = "anstyle-wincon"
55
+ version = "3.0.11"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d"
58
+ dependencies = [
59
+ "anstyle",
60
+ "once_cell_polyfill",
61
+ "windows-sys",
62
+ ]
63
+
64
+ [[package]]
65
+ name = "block-buffer"
66
+ version = "0.10.4"
67
+ source = "registry+https://github.com/rust-lang/crates.io-index"
68
+ checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
69
+ dependencies = [
70
+ "generic-array",
71
+ ]
72
+
73
+ [[package]]
74
+ name = "cc"
75
+ version = "1.12.0"
76
+ source = "registry+https://github.com/rust-lang/crates.io-index"
77
+ checksum = "95e45cf2980b2d467be49a9ed942c9179b701063a7ca3d037de7ee9bd67f8d66"
78
+ dependencies = [
79
+ "find-msvc-tools",
80
+ "shlex",
81
+ ]
82
+
83
+ [[package]]
84
+ name = "cfg-if"
85
+ version = "1.0.5"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
88
+
89
+ [[package]]
90
+ name = "clap"
91
+ version = "4.6.10"
92
+ source = "registry+https://github.com/rust-lang/crates.io-index"
93
+ checksum = "50066ca966813ca8957ee15361752f19424a8ff620dbe9c8993d9f99d99b04b3"
94
+ dependencies = [
95
+ "clap_builder",
96
+ "clap_derive",
97
+ ]
98
+
99
+ [[package]]
100
+ name = "clap_builder"
101
+ version = "4.6.10"
102
+ source = "registry+https://github.com/rust-lang/crates.io-index"
103
+ checksum = "a0ed97c96ef4efb3cc84e09fa388df4463e7cc3224ec38d7b1d9e45749333590"
104
+ dependencies = [
105
+ "anstream",
106
+ "anstyle",
107
+ "clap_lex",
108
+ "strsim",
109
+ ]
110
+
111
+ [[package]]
112
+ name = "clap_derive"
113
+ version = "4.6.9"
114
+ source = "registry+https://github.com/rust-lang/crates.io-index"
115
+ checksum = "b4c174f11f949b9ca8c60580925e282b9cbd5454750e506f08648b2038080cd7"
116
+ dependencies = [
117
+ "heck",
118
+ "proc-macro2",
119
+ "quote",
120
+ "syn",
121
+ ]
122
+
123
+ [[package]]
124
+ name = "clap_lex"
125
+ version = "1.1.2"
126
+ source = "registry+https://github.com/rust-lang/crates.io-index"
127
+ checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79"
128
+
129
+ [[package]]
130
+ name = "colorchoice"
131
+ version = "1.0.5"
132
+ source = "registry+https://github.com/rust-lang/crates.io-index"
133
+ checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
134
+
135
+ [[package]]
136
+ name = "cpufeatures"
137
+ version = "0.2.17"
138
+ source = "registry+https://github.com/rust-lang/crates.io-index"
139
+ checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
140
+ dependencies = [
141
+ "libc",
142
+ ]
143
+
144
+ [[package]]
145
+ name = "crypto-common"
146
+ version = "0.1.7"
147
+ source = "registry+https://github.com/rust-lang/crates.io-index"
148
+ checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
149
+ dependencies = [
150
+ "generic-array",
151
+ "typenum",
152
+ ]
153
+
154
+ [[package]]
155
+ name = "digest"
156
+ version = "0.10.7"
157
+ source = "registry+https://github.com/rust-lang/crates.io-index"
158
+ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
159
+ dependencies = [
160
+ "block-buffer",
161
+ "crypto-common",
162
+ ]
163
+
164
+ [[package]]
165
+ name = "equivalent"
166
+ version = "1.0.3"
167
+ source = "registry+https://github.com/rust-lang/crates.io-index"
168
+ checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
169
+
170
+ [[package]]
171
+ name = "find-msvc-tools"
172
+ version = "0.1.16"
173
+ source = "registry+https://github.com/rust-lang/crates.io-index"
174
+ checksum = "3e44f110d1777dc6559a51e7d45083945ded4f1bf3305494350f693b6d20b9c8"
175
+
176
+ [[package]]
177
+ name = "foldhash"
178
+ version = "0.2.0"
179
+ source = "registry+https://github.com/rust-lang/crates.io-index"
180
+ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
181
+
182
+ [[package]]
183
+ name = "generic-array"
184
+ version = "0.14.7"
185
+ source = "registry+https://github.com/rust-lang/crates.io-index"
186
+ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
187
+ dependencies = [
188
+ "typenum",
189
+ "version_check",
190
+ ]
191
+
192
+ [[package]]
193
+ name = "gram-diagnostics"
194
+ version = "0.7.0"
195
+ source = "registry+https://github.com/rust-lang/crates.io-index"
196
+ checksum = "fbdbe71d18045c8be6cf3dc679866944ff022a2abb15e50bc77a6bdffcda5658"
197
+ dependencies = [
198
+ "serde",
199
+ ]
200
+
201
+ [[package]]
202
+ name = "gram-frame"
203
+ version = "0.1.8"
204
+ dependencies = [
205
+ "gram-value",
206
+ "serde_json",
207
+ "sha2",
208
+ "tree-sitter",
209
+ "tree-sitter-gram",
210
+ ]
211
+
212
+ [[package]]
213
+ name = "gram-frame-cli"
214
+ version = "0.1.8"
215
+ dependencies = [
216
+ "clap",
217
+ "gram-diagnostics",
218
+ "gram-frame",
219
+ "gram-value",
220
+ "serde_json",
221
+ ]
222
+
223
+ [[package]]
224
+ name = "gram-value"
225
+ version = "0.2.0"
226
+ source = "registry+https://github.com/rust-lang/crates.io-index"
227
+ checksum = "faf2134344aad0faf01907d11bd34a1810b7201df7171b20059a1d3b88931dea"
228
+
229
+ [[package]]
230
+ name = "hashbrown"
231
+ version = "0.17.2"
232
+ source = "registry+https://github.com/rust-lang/crates.io-index"
233
+ checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc"
234
+
235
+ [[package]]
236
+ name = "heck"
237
+ version = "0.5.0"
238
+ source = "registry+https://github.com/rust-lang/crates.io-index"
239
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
240
+
241
+ [[package]]
242
+ name = "indexmap"
243
+ version = "2.14.2"
244
+ source = "registry+https://github.com/rust-lang/crates.io-index"
245
+ checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
246
+ dependencies = [
247
+ "equivalent",
248
+ "hashbrown",
249
+ ]
250
+
251
+ [[package]]
252
+ name = "is_terminal_polyfill"
253
+ version = "1.70.2"
254
+ source = "registry+https://github.com/rust-lang/crates.io-index"
255
+ checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695"
256
+
257
+ [[package]]
258
+ name = "itoa"
259
+ version = "1.0.19"
260
+ source = "registry+https://github.com/rust-lang/crates.io-index"
261
+ checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
262
+
263
+ [[package]]
264
+ name = "libc"
265
+ version = "0.2.191"
266
+ source = "registry+https://github.com/rust-lang/crates.io-index"
267
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
268
+
269
+ [[package]]
270
+ name = "memchr"
271
+ version = "2.8.3"
272
+ source = "registry+https://github.com/rust-lang/crates.io-index"
273
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
274
+
275
+ [[package]]
276
+ name = "once_cell_polyfill"
277
+ version = "1.70.2"
278
+ source = "registry+https://github.com/rust-lang/crates.io-index"
279
+ checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
280
+
281
+ [[package]]
282
+ name = "proc-macro2"
283
+ version = "1.0.107"
284
+ source = "registry+https://github.com/rust-lang/crates.io-index"
285
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
286
+ dependencies = [
287
+ "unicode-ident",
288
+ ]
289
+
290
+ [[package]]
291
+ name = "quote"
292
+ version = "1.0.47"
293
+ source = "registry+https://github.com/rust-lang/crates.io-index"
294
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
295
+ dependencies = [
296
+ "proc-macro2",
297
+ ]
298
+
299
+ [[package]]
300
+ name = "regex"
301
+ version = "1.13.2"
302
+ source = "registry+https://github.com/rust-lang/crates.io-index"
303
+ checksum = "9807af0e638c12e753aa1b4e601791bf2a8f71274023c8bbeec12fc149950857"
304
+ dependencies = [
305
+ "aho-corasick",
306
+ "memchr",
307
+ "regex-automata",
308
+ "regex-syntax",
309
+ ]
310
+
311
+ [[package]]
312
+ name = "regex-automata"
313
+ version = "0.4.19"
314
+ source = "registry+https://github.com/rust-lang/crates.io-index"
315
+ checksum = "41d60ef07df457506a0a1a2073112eb4aae5733dbd2813c3da77d1b0fd441158"
316
+ dependencies = [
317
+ "aho-corasick",
318
+ "memchr",
319
+ "regex-syntax",
320
+ ]
321
+
322
+ [[package]]
323
+ name = "regex-syntax"
324
+ version = "0.8.12"
325
+ source = "registry+https://github.com/rust-lang/crates.io-index"
326
+ checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6"
327
+
328
+ [[package]]
329
+ name = "serde"
330
+ version = "1.0.229"
331
+ source = "registry+https://github.com/rust-lang/crates.io-index"
332
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
333
+ dependencies = [
334
+ "serde_core",
335
+ "serde_derive",
336
+ ]
337
+
338
+ [[package]]
339
+ name = "serde_core"
340
+ version = "1.0.229"
341
+ source = "registry+https://github.com/rust-lang/crates.io-index"
342
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
343
+ dependencies = [
344
+ "serde_derive",
345
+ ]
346
+
347
+ [[package]]
348
+ name = "serde_derive"
349
+ version = "1.0.229"
350
+ source = "registry+https://github.com/rust-lang/crates.io-index"
351
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
352
+ dependencies = [
353
+ "proc-macro2",
354
+ "quote",
355
+ "syn",
356
+ ]
357
+
358
+ [[package]]
359
+ name = "serde_json"
360
+ version = "1.0.154"
361
+ source = "registry+https://github.com/rust-lang/crates.io-index"
362
+ checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
363
+ dependencies = [
364
+ "foldhash",
365
+ "indexmap",
366
+ "itoa",
367
+ "memchr",
368
+ "serde",
369
+ "serde_core",
370
+ "zmij",
371
+ ]
372
+
373
+ [[package]]
374
+ name = "sha2"
375
+ version = "0.10.9"
376
+ source = "registry+https://github.com/rust-lang/crates.io-index"
377
+ checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
378
+ dependencies = [
379
+ "cfg-if",
380
+ "cpufeatures",
381
+ "digest",
382
+ ]
383
+
384
+ [[package]]
385
+ name = "shlex"
386
+ version = "2.0.1"
387
+ source = "registry+https://github.com/rust-lang/crates.io-index"
388
+ checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
389
+
390
+ [[package]]
391
+ name = "streaming-iterator"
392
+ version = "0.1.9"
393
+ source = "registry+https://github.com/rust-lang/crates.io-index"
394
+ checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520"
395
+
396
+ [[package]]
397
+ name = "strsim"
398
+ version = "0.11.1"
399
+ source = "registry+https://github.com/rust-lang/crates.io-index"
400
+ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
401
+
402
+ [[package]]
403
+ name = "syn"
404
+ version = "3.0.10"
405
+ source = "registry+https://github.com/rust-lang/crates.io-index"
406
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
407
+ dependencies = [
408
+ "proc-macro2",
409
+ "quote",
410
+ "unicode-ident",
411
+ ]
412
+
413
+ [[package]]
414
+ name = "tree-sitter"
415
+ version = "0.25.10"
416
+ source = "registry+https://github.com/rust-lang/crates.io-index"
417
+ checksum = "78f873475d258561b06f1c595d93308a7ed124d9977cb26b148c2084a4a3cc87"
418
+ dependencies = [
419
+ "cc",
420
+ "regex",
421
+ "regex-syntax",
422
+ "serde_json",
423
+ "streaming-iterator",
424
+ "tree-sitter-language",
425
+ ]
426
+
427
+ [[package]]
428
+ name = "tree-sitter-gram"
429
+ version = "0.7.0"
430
+ source = "registry+https://github.com/rust-lang/crates.io-index"
431
+ checksum = "fae4808a449d060c112e2701876dff11c1c53d6d9e2a1350573093591e5f3ebf"
432
+ dependencies = [
433
+ "cc",
434
+ "tree-sitter-language",
435
+ ]
436
+
437
+ [[package]]
438
+ name = "tree-sitter-language"
439
+ version = "0.1.9"
440
+ source = "registry+https://github.com/rust-lang/crates.io-index"
441
+ checksum = "d0af592be68c579aa78a16846bd19422978c3c52e438523d45ff5d1bff1f9d4a"
442
+
443
+ [[package]]
444
+ name = "typenum"
445
+ version = "1.20.1"
446
+ source = "registry+https://github.com/rust-lang/crates.io-index"
447
+ checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
448
+
449
+ [[package]]
450
+ name = "unicode-ident"
451
+ version = "1.0.27"
452
+ source = "registry+https://github.com/rust-lang/crates.io-index"
453
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
454
+
455
+ [[package]]
456
+ name = "utf8parse"
457
+ version = "0.2.2"
458
+ source = "registry+https://github.com/rust-lang/crates.io-index"
459
+ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
460
+
461
+ [[package]]
462
+ name = "version_check"
463
+ version = "0.9.5"
464
+ source = "registry+https://github.com/rust-lang/crates.io-index"
465
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
466
+
467
+ [[package]]
468
+ name = "windows-link"
469
+ version = "0.2.1"
470
+ source = "registry+https://github.com/rust-lang/crates.io-index"
471
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
472
+
473
+ [[package]]
474
+ name = "windows-sys"
475
+ version = "0.61.2"
476
+ source = "registry+https://github.com/rust-lang/crates.io-index"
477
+ checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
478
+ dependencies = [
479
+ "windows-link",
480
+ ]
481
+
482
+ [[package]]
483
+ name = "zmij"
484
+ version = "1.0.23"
485
+ source = "registry+https://github.com/rust-lang/crates.io-index"
486
+ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
@@ -0,0 +1,41 @@
1
+ [package]
2
+ name = "gram-frame"
3
+ version = "0.1.8"
4
+ edition = "2021"
5
+ rust-version = "1.75"
6
+ description = "The semantic layer of the gram notation: a flat, graph-neutral element table (the frame), derived graph view, provenance, profiles, and lowering"
7
+ license = "MIT"
8
+ repository = "https://github.com/gram-data/gram-frame"
9
+ homepage = "https://github.com/gram-data/gram-frame#readme"
10
+ documentation = "https://docs.rs/gram-frame"
11
+ keywords = ["gram", "graph", "parser", "semantics"]
12
+ categories = ["data-structures", "parsing"]
13
+ readme = "README.md"
14
+ exclude = [
15
+ "cli/",
16
+ "conformance/",
17
+ "design/",
18
+ "tests/",
19
+ "examples/",
20
+ "bindings/",
21
+ ".github/",
22
+ ".agents/",
23
+ ".claude/",
24
+ "AGENTS.md",
25
+ "CLAUDE.md",
26
+ "RELEASING.md",
27
+ "CHANGELOG.md",
28
+ ]
29
+
30
+ [dependencies]
31
+ gram-value = "0.2.0"
32
+ tree-sitter = "0.25"
33
+ tree-sitter-gram = "=0.7.0"
34
+
35
+ [dev-dependencies]
36
+ serde_json = "1"
37
+ sha2 = "0.10"
38
+
39
+ [workspace]
40
+ members = ["cli"]
41
+ default-members = [".", "cli"]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andreas Kollegger
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,55 @@
1
+ Metadata-Version: 2.4
2
+ Name: gram-frame
3
+ Version: 0.1.8
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: License :: OSI Approved :: MIT License
6
+ Requires-Dist: gram-value>=0.2.0,<0.3
7
+ Summary: The gram frame: a flat table of elements lowered from gram text, with diagnostics
8
+ License: MIT
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
11
+ Project-URL: Repository, https://github.com/gram-data/gram-frame
12
+
13
+ # gram-frame for Python
14
+
15
+ The gram frame: a flat table of elements lowered from [gram](https://github.com/gram-data/tree-sitter-gram) text, with diagnostics. This package is the Rust library [`gram-frame`](https://github.com/gram-data/gram-frame) built as a Python extension, so it follows exactly the rules the library does.
16
+
17
+ ```python
18
+ import gram_frame
19
+
20
+ rows, diagnostics = gram_frame.lower("(a:A {x: 1})-[:R]->(b)")
21
+ # rows: (id, labels, props, members) tuples; row 0 is the frame row; props is a gram_value.MapValue
22
+ # diagnostics: (code, severity, start, end, line, column, help), start and end are byte offsets
23
+ ```
24
+
25
+ Property values are `gram_value` objects. Requires Python 3.10 or later. `lower` raises `UnicodeEncodeError` for a string with a lone surrogate, which has no UTF-8 encoding.
26
+
27
+ ## The frame is not a tree
28
+
29
+ A row's `members` are row indexes, not nested rows. One row can be a member of several rows, and can appear twice in one row's `members` (a self-loop `(a)-[r:R]->(a)` lists `a` twice), so the frame is a directed acyclic graph of rows, never a tree. Rows are never copied: reaching a row by two paths reaches the same row.
30
+
31
+ - Walk `members` with a visited set, or memoize per row index. Treating members as children visits a shared row once per path, and the unfolded size can be exponential in the size of the table (31 elements can unfold into 2^30 leaves).
32
+ - Row order says nothing about depth: a member can come before or after its container.
33
+ - Rows do not record their parents. Build the inverse index once if you need it.
34
+ - A row is an atomic pattern (no members), one member (provisionally an annotated pattern, ADR-012 4.4) or a general pattern (two or more); the number of members is the first thing to look at.
35
+
36
+ The model is in [ADR-012](https://github.com/gram-data/gram-frame/blob/main/design/adr/ADR-012-frame-data-model-and-arity-view.md).
37
+
38
+ ## Conformance declaration (ADR-008 2.7)
39
+
40
+ | | |
41
+ |---|---|
42
+ | Corpus | `conformance/` of this repository at the tag `vX.Y.Z` of the release |
43
+ | Fidelity | Shared core: the frame and diagnostics are produced by the Rust library itself |
44
+ | Layers | Layer 2 (semantic lowering to the frame and diagnostics) |
45
+
46
+ ## Build and test
47
+
48
+ ```bash
49
+ cd bindings/python
50
+ python -m venv .venv && . .venv/bin/activate
51
+ pip install maturin pytest gram-value
52
+ maturin develop --release
53
+ pytest
54
+ ```
55
+
@@ -0,0 +1,76 @@
1
+ # gram-frame
2
+
3
+ The semantic layer of the [gram](https://github.com/gram-data/tree-sitter-gram) notation: a flat, graph-neutral element table (**the frame**), a derived graph classification view, the lowering algorithm that produces the frame from a syntax tree, diagnostics with remediation help, syntax provenance, a language-neutral conformance corpus, and the `gram-frame` CLI.
4
+
5
+ ## Architecture
6
+
7
+ `gram-frame` sits as **Layer 2** in a three-layer stack:
8
+
9
+ 1. **Syntactic authority ([tree-sitter-gram](https://github.com/gram-data/tree-sitter-gram)):** concrete syntax tree (CST).
10
+ 2. **Semantic layer (`gram-frame`):** lowers the CST with [gram-value](https://github.com/gram-data/gram-value) property values into a flat, graph-neutral table of pattern rows (`id`, `labels`, `props`, `members`), resolving document-wide identifiers, detecting conflicts and cycles, recording syntax provenance, and offering a derived graph view (`graph::classify`) for `frame`, `node`, `annotation`, `relationship`, `path`, and `sub-graph`.
11
+ 3. **Direct-to-frame / profile parsers:** downstream loaders (such as property-graph subsets like `relate-gram`) that conform to the frame rules and apply consumer profiles on top.
12
+
13
+ ## Library usage
14
+
15
+ ```rust
16
+ use gram_frame::{lower, graph::{classify, GraphClass}};
17
+
18
+ let out = lower("(a:Person {name: \"Ada\"})-[:KNOWS]->(b:Person)");
19
+ assert!(out.diagnostics.is_empty());
20
+ assert!(out.frame.validate().is_empty());
21
+
22
+ assert_eq!(
23
+ classify(&out.frame),
24
+ [GraphClass::Frame, GraphClass::Relationship, GraphClass::Node, GraphClass::Node]
25
+ );
26
+ ```
27
+
28
+ ### The frame is not a tree
29
+
30
+ A row's `members` are row handles, not nested rows. One row can be a member of several rows, and can appear twice in one row's `members`; the only containment rule is that no row reaches itself (the other table invariants, such as in-range handles and a memberless row 0, still hold). The frame is a directed acyclic graph of rows. Walk it with a visited set or memoize per handle, because treating members as children visits a shared row once per path and the unfolded size can be exponential. Handle order says nothing about depth, and parents are not recorded. A row is an atomic pattern (no members), one member (provisionally an annotated pattern, ADR-012 4.4) or a general pattern (two or more); `graph::classify` refines that. The model is in [ADR-012](design/adr/ADR-012-frame-data-model-and-arity-view.md).
31
+
32
+ ## Command-line tool (`gram-frame`)
33
+
34
+ Run from a checkout with Cargo:
35
+
36
+ ```bash
37
+ # Check files, directories, stdin, or an inline expression
38
+ cargo run -p gram-frame-cli -- check file.gram
39
+ cargo run -p gram-frame-cli -- check -e '(a)-[:K]->(b)'
40
+ cargo run -p gram-frame-cli -- check --profile property-graph file.gram
41
+ cargo run -p gram-frame-cli -- check --strict --json file.gram
42
+
43
+ # Inspect the frame as a text table, JSON, or conformance corpus gram notation
44
+ cargo run -p gram-frame-cli -- table file.gram
45
+ cargo run -p gram-frame-cli -- table --graph --provenance file.gram
46
+ cargo run -p gram-frame-cli -- table --format gram file.gram
47
+
48
+ # Install, check, list, or remove the bundled agent skill
49
+ cargo run -p gram-frame-cli -- skill install
50
+ cargo run -p gram-frame-cli -- skill install --here --agent agents
51
+ ```
52
+
53
+ ## Conformance corpus and tests
54
+
55
+ The language-neutral conformance corpus lives under [`conformance/`](conformance/) (format in [ADR-005](design/adr/ADR-005-conformance-case-format.md)).
56
+
57
+ ```bash
58
+ cargo test --workspace
59
+ cargo clippy --workspace --all-targets -- -D warnings
60
+
61
+ # Optional 50k-node release benchmark
62
+ cargo test --release --test scale -- --ignored --nocapture
63
+
64
+ # Validate corpus expectation files with the gram CLI (from tree-sitter-gram)
65
+ gram lint --strict conformance/vocabulary.gram $(find conformance -name frame.gram -o -name diagnostics.gram -o -name case.gram)
66
+ ```
67
+
68
+ ## Design documents
69
+
70
+ - **RFCs:** [`design/rfc/README.md`](design/rfc/README.md) ([RFC-001](design/rfc/RFC-001-frame-model-and-semantics.md) accepted; [RFC-002](design/rfc/RFC-002-doc-comments-as-annotations.md) in review)
71
+ - **ADRs:** [`design/adr/README.md`](design/adr/README.md) (ADR-001 through ADR-006 accepted)
72
+ - **Notes:** [`design/notes/2026-11-16-layers-and-the-frame.md`](design/notes/2026-11-16-layers-and-the-frame.md)
73
+
74
+ ## License
75
+
76
+ [MIT](LICENSE)