lemmascript 0.0.1 → 0.1.0
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/LICENSE +21 -0
- package/README.md +101 -3
- package/package.json +30 -20
- package/tools/dist/dafny-commands.js +104 -0
- package/tools/dist/dafny-emit.js +449 -0
- package/tools/dist/emit.js +253 -0
- package/tools/dist/extract.js +435 -0
- package/tools/dist/ir.js +7 -0
- package/tools/dist/lsc.js +118 -0
- package/tools/dist/rawir.js +10 -0
- package/tools/dist/resolve.js +451 -0
- package/tools/dist/specparser.js +251 -0
- package/tools/dist/transform.js +745 -0
- package/tools/dist/typedir.js +7 -0
- package/tools/dist/types.js +38 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -4
- package/src/index.ts +0 -1
- package/tsconfig.json +0 -14
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type mapping — TS types → Lean types.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for type-related decisions.
|
|
5
|
+
* The transform phase imports this.
|
|
6
|
+
*/
|
|
7
|
+
export function tyToLean(ty) {
|
|
8
|
+
switch (ty.kind) {
|
|
9
|
+
case "nat": return "Nat";
|
|
10
|
+
case "int": return "Int";
|
|
11
|
+
case "bool": return "Bool";
|
|
12
|
+
case "string": return "String";
|
|
13
|
+
case "void": return "Unit";
|
|
14
|
+
case "array": {
|
|
15
|
+
const elem = tyToLean(ty.elem);
|
|
16
|
+
return elem.includes(" ") ? `Array (${elem})` : `Array ${elem}`;
|
|
17
|
+
}
|
|
18
|
+
case "user": return ty.name;
|
|
19
|
+
case "unknown": return "_";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function parseTsType(tsType) {
|
|
23
|
+
const t = tsType.trim();
|
|
24
|
+
if (t === "number")
|
|
25
|
+
return { kind: "int" };
|
|
26
|
+
if (t === "nat")
|
|
27
|
+
return { kind: "nat" };
|
|
28
|
+
if (t === "boolean")
|
|
29
|
+
return { kind: "bool" };
|
|
30
|
+
if (t === "string")
|
|
31
|
+
return { kind: "string" };
|
|
32
|
+
if (t === "void" || t === "undefined")
|
|
33
|
+
return { kind: "void" };
|
|
34
|
+
const m = t.match(/^(?:Array<(.+)>|(.+)\[\])$/);
|
|
35
|
+
if (m)
|
|
36
|
+
return { kind: "array", elem: parseTsType(m[1] || m[2]) };
|
|
37
|
+
return { kind: "user", name: t };
|
|
38
|
+
}
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const VERSION = "0.0.1";
|
package/dist/index.js
DELETED
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const VERSION = "0.0.1";
|
package/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "Node16",
|
|
5
|
-
"moduleResolution": "Node16",
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"rootDir": "src",
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true
|
|
12
|
-
},
|
|
13
|
-
"include": ["src"]
|
|
14
|
-
}
|