@terminals-tech/py2bend 0.1.0 → 0.1.1
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.
- package/dist/index.cjs +11 -7
- package/dist/index.js +10 -6
- package/package.json +22 -26
- package/LICENSE +0 -21
package/dist/index.cjs
CHANGED
|
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
//
|
|
20
|
+
// ../../lib/py2bend/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
BUILTIN_MAP: () => BUILTIN_MAP,
|
|
@@ -30,7 +30,7 @@ __export(index_exports, {
|
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(index_exports);
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// ../../lib/py2bend/parser.ts
|
|
34
34
|
function tokenizeLines(source) {
|
|
35
35
|
return source.split("\n").map((raw, i) => {
|
|
36
36
|
const text = raw;
|
|
@@ -537,6 +537,7 @@ function parseUnary(text, lineNo, errors) {
|
|
|
537
537
|
}
|
|
538
538
|
function parsePostfix(text, lineNo, errors) {
|
|
539
539
|
text = text.trim();
|
|
540
|
+
let node = parsePrimary(text, lineNo, errors);
|
|
540
541
|
const parsed = parsePrimaryWithPostfix(text, lineNo, errors);
|
|
541
542
|
return parsed;
|
|
542
543
|
}
|
|
@@ -746,6 +747,10 @@ function parsePrimaryAt(text, pos, lineNo, errors) {
|
|
|
746
747
|
endPos: pos + remaining.length
|
|
747
748
|
};
|
|
748
749
|
}
|
|
750
|
+
function parsePrimary(text, lineNo, errors) {
|
|
751
|
+
const { node } = parsePrimaryAt(text, 0, lineNo, errors);
|
|
752
|
+
return node;
|
|
753
|
+
}
|
|
749
754
|
function splitTopLevel(text, delimiter) {
|
|
750
755
|
const parts = [];
|
|
751
756
|
let parenDepth = 0;
|
|
@@ -855,7 +860,7 @@ function parseCallArgs(text, lineNo, errors) {
|
|
|
855
860
|
return { args, kwargs };
|
|
856
861
|
}
|
|
857
862
|
|
|
858
|
-
//
|
|
863
|
+
// ../../lib/py2bend/transforms.ts
|
|
859
864
|
function transformModule(ast) {
|
|
860
865
|
return {
|
|
861
866
|
type: "BendModule",
|
|
@@ -973,7 +978,7 @@ function passthrough(node) {
|
|
|
973
978
|
};
|
|
974
979
|
}
|
|
975
980
|
|
|
976
|
-
//
|
|
981
|
+
// ../../lib/py2bend/stdlib.ts
|
|
977
982
|
var BUILTIN_MAP = {
|
|
978
983
|
len: "List/len",
|
|
979
984
|
print: "IO/print",
|
|
@@ -1062,7 +1067,7 @@ var METHOD_MAP = {
|
|
|
1062
1067
|
"str.format": "Str/format"
|
|
1063
1068
|
};
|
|
1064
1069
|
|
|
1065
|
-
//
|
|
1070
|
+
// ../../lib/py2bend/codegen.ts
|
|
1066
1071
|
function generateBend(module2) {
|
|
1067
1072
|
const lines = [];
|
|
1068
1073
|
for (const node of module2.body) {
|
|
@@ -1293,7 +1298,7 @@ function indent(depth) {
|
|
|
1293
1298
|
return " ".repeat(depth);
|
|
1294
1299
|
}
|
|
1295
1300
|
|
|
1296
|
-
//
|
|
1301
|
+
// ../../lib/py2bend/index.ts
|
|
1297
1302
|
function compile(pythonSource) {
|
|
1298
1303
|
const warnings = [];
|
|
1299
1304
|
const { ast, errors: parseErrors } = parsePython(pythonSource);
|
|
@@ -1325,4 +1330,3 @@ function compile(pythonSource) {
|
|
|
1325
1330
|
parsePython,
|
|
1326
1331
|
transformModule
|
|
1327
1332
|
});
|
|
1328
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// ../../lib/py2bend/parser.ts
|
|
2
2
|
function tokenizeLines(source) {
|
|
3
3
|
return source.split("\n").map((raw, i) => {
|
|
4
4
|
const text = raw;
|
|
@@ -505,6 +505,7 @@ function parseUnary(text, lineNo, errors) {
|
|
|
505
505
|
}
|
|
506
506
|
function parsePostfix(text, lineNo, errors) {
|
|
507
507
|
text = text.trim();
|
|
508
|
+
let node = parsePrimary(text, lineNo, errors);
|
|
508
509
|
const parsed = parsePrimaryWithPostfix(text, lineNo, errors);
|
|
509
510
|
return parsed;
|
|
510
511
|
}
|
|
@@ -714,6 +715,10 @@ function parsePrimaryAt(text, pos, lineNo, errors) {
|
|
|
714
715
|
endPos: pos + remaining.length
|
|
715
716
|
};
|
|
716
717
|
}
|
|
718
|
+
function parsePrimary(text, lineNo, errors) {
|
|
719
|
+
const { node } = parsePrimaryAt(text, 0, lineNo, errors);
|
|
720
|
+
return node;
|
|
721
|
+
}
|
|
717
722
|
function splitTopLevel(text, delimiter) {
|
|
718
723
|
const parts = [];
|
|
719
724
|
let parenDepth = 0;
|
|
@@ -823,7 +828,7 @@ function parseCallArgs(text, lineNo, errors) {
|
|
|
823
828
|
return { args, kwargs };
|
|
824
829
|
}
|
|
825
830
|
|
|
826
|
-
//
|
|
831
|
+
// ../../lib/py2bend/transforms.ts
|
|
827
832
|
function transformModule(ast) {
|
|
828
833
|
return {
|
|
829
834
|
type: "BendModule",
|
|
@@ -941,7 +946,7 @@ function passthrough(node) {
|
|
|
941
946
|
};
|
|
942
947
|
}
|
|
943
948
|
|
|
944
|
-
//
|
|
949
|
+
// ../../lib/py2bend/stdlib.ts
|
|
945
950
|
var BUILTIN_MAP = {
|
|
946
951
|
len: "List/len",
|
|
947
952
|
print: "IO/print",
|
|
@@ -1030,7 +1035,7 @@ var METHOD_MAP = {
|
|
|
1030
1035
|
"str.format": "Str/format"
|
|
1031
1036
|
};
|
|
1032
1037
|
|
|
1033
|
-
//
|
|
1038
|
+
// ../../lib/py2bend/codegen.ts
|
|
1034
1039
|
function generateBend(module) {
|
|
1035
1040
|
const lines = [];
|
|
1036
1041
|
for (const node of module.body) {
|
|
@@ -1261,7 +1266,7 @@ function indent(depth) {
|
|
|
1261
1266
|
return " ".repeat(depth);
|
|
1262
1267
|
}
|
|
1263
1268
|
|
|
1264
|
-
//
|
|
1269
|
+
// ../../lib/py2bend/index.ts
|
|
1265
1270
|
function compile(pythonSource) {
|
|
1266
1271
|
const warnings = [];
|
|
1267
1272
|
const { ast, errors: parseErrors } = parsePython(pythonSource);
|
|
@@ -1292,4 +1297,3 @@ export {
|
|
|
1292
1297
|
parsePython,
|
|
1293
1298
|
transformModule
|
|
1294
1299
|
};
|
|
1295
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terminals-tech/py2bend",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Deterministic mesh compilation for Python-to-Bend translation",
|
|
5
|
+
"license": "BUSL-1.1",
|
|
6
|
+
"author": "Intuition Labs LLC",
|
|
5
7
|
"type": "module",
|
|
6
8
|
"main": "./dist/index.cjs",
|
|
7
9
|
"module": "./dist/index.js",
|
|
@@ -17,35 +19,29 @@
|
|
|
17
19
|
"dist"
|
|
18
20
|
],
|
|
19
21
|
"scripts": {
|
|
20
|
-
"build": "tsup",
|
|
21
|
-
"
|
|
22
|
-
"typecheck": "tsc --noEmit"
|
|
23
|
-
"test": "vitest run"
|
|
22
|
+
"build": "tsup ../../lib/py2bend/index.ts --format esm,cjs --dts --out-dir dist",
|
|
23
|
+
"clean": "rm -rf dist",
|
|
24
|
+
"typecheck": "tsc --noEmit --project ../../tsconfig.json"
|
|
24
25
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"license": "MIT",
|
|
26
|
+
"keywords": [
|
|
27
|
+
"python",
|
|
28
|
+
"bend",
|
|
29
|
+
"hvm",
|
|
30
|
+
"compiler",
|
|
31
|
+
"deterministic",
|
|
32
|
+
"wasm",
|
|
33
|
+
"terminals"
|
|
34
|
+
],
|
|
35
35
|
"repository": {
|
|
36
36
|
"type": "git",
|
|
37
|
-
"url": "https://github.com/
|
|
37
|
+
"url": "git+https://github.com/wheattoast11/observable-computation.git",
|
|
38
38
|
"directory": "packages/py2bend"
|
|
39
39
|
},
|
|
40
|
+
"homepage": "https://github.com/wheattoast11/observable-computation/tree/main/packages/py2bend",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/wheattoast11/observable-computation/issues"
|
|
43
|
+
},
|
|
40
44
|
"publishConfig": {
|
|
41
45
|
"access": "public"
|
|
42
|
-
}
|
|
43
|
-
"keywords": [
|
|
44
|
-
"python",
|
|
45
|
-
"bend",
|
|
46
|
-
"transpiler",
|
|
47
|
-
"compiler",
|
|
48
|
-
"interaction-nets",
|
|
49
|
-
"hvm"
|
|
50
|
-
]
|
|
46
|
+
}
|
|
51
47
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Intuition Labs LLC
|
|
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.
|