@fraczak/k 7.0.2 → 7.2.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/CHANGELOG.md +75 -0
- package/DOCS/CODECS.md +37 -2
- package/DOCS/CODEC_ARCHITECTURE.md +12 -5
- package/DOCS/FILE_FORMATS.md +238 -15
- package/DOCS/POLYMORPHIC_IR.md +104 -0
- package/DOCS/REPL.md +11 -3
- package/DOCS/WEB_REPL_REQUIREMENTS.md +1 -1
- package/JOURNAL.md +288 -0
- package/README.md +12 -3
- package/Value.mjs +28 -3
- package/access-table.mjs +343 -0
- package/backend-api.mjs +23 -1
- package/backends/llvm/README.md +20 -21
- package/backends/llvm/bin/k-llvm-build.mjs +105 -32
- package/backends/llvm/bin/k-llvm-compile.mjs +63 -24
- package/backends/llvm/bin/k-llvm.mjs +292 -0
- package/backends/llvm/runtime/krt.c +8 -0
- package/backends/llvm/runtime/krt.h +1 -0
- package/backends/llvm/src/cli.mjs +95 -17
- package/backends/llvm/src/executable.mjs +128 -11
- package/backends/llvm/src/kvm2llvm.mjs +10 -5
- package/backends/llvm/src/llvm.mjs +121 -9
- package/backends/llvm/tests/integration.sh +11 -11
- package/backends/llvm/{bin → tests}/k-llvm-run.mjs +48 -22
- package/backends/llvm/tests/perf-support.mjs +24 -3
- package/backends/llvm/tests/test-llvm.mjs +22 -1
- package/backends/wasm/bin/k-wasm-compile.mjs +46 -20
- package/backends/wasm/bin/k-wasm-run.mjs +61 -20
- package/backends/wasm/bin/k-wasm.mjs +47 -13
- package/backends/wasm/src/cli.mjs +141 -19
- package/backends/wasm/src/wasm.mjs +130 -23
- package/browser/repl-browser.mjs +16 -5
- package/browser/tree-view.mjs +47 -8
- package/browser/vfs-data.mjs +6 -5
- package/codecs/README.md +1 -0
- package/codecs/djson.mjs +270 -0
- package/codecs/int.mjs +2 -1
- package/codecs/json.mjs +7 -2
- package/codecs/k-parse.mjs +36 -9
- package/codecs/k-print.mjs +26 -6
- package/codecs/runtime/codec-sdk.mjs +24 -6
- package/codecs/runtime/pattern-json.mjs +80 -1
- package/codecs/runtime/prefix-codec.mjs +629 -67
- package/codecs/runtime/show-value.mjs +93 -51
- package/codecs/runtime/unicode-string.mjs +29 -6
- package/codecs/show.mjs +24 -6
- package/codecs/utf16.mjs +2 -1
- package/k.mjs +56 -16
- package/kir.mjs +58 -19
- package/kvm.mjs +49 -12
- package/objects/compile.mjs +37 -23
- package/objects/decompile.mjs +40 -10
- package/objects/extract-aliases.mjs +44 -14
- package/objects/inspect.mjs +19 -14
- package/objects/validate.mjs +18 -11
- package/package.json +11 -3
- package/pkir.mjs +772 -0
- package/repl.mjs +92 -23
- package/scripts/build-repl-html.mjs +22 -3
- package/scripts/perf-ieee.mjs +264 -13
- package/scripts/perf-int.mjs +315 -22
- package/scripts/perf-multiplication.mjs +58 -7
- package/scripts/perf-poly.mjs +306 -24
- package/scripts/run-tests.mjs +3 -0
- package/tests/test-access-table.mjs +213 -0
- package/tests/test-codecs.mjs +168 -0
- package/tests/test-pkir.mjs +530 -0
- package/tests/test-polymorphic-tdd.mjs +196 -0
- package/tests/test-repl-html.mjs +16 -2
- package/tests/test-repl.mjs +63 -1
- package/backends/llvm/bin/k-llvm-jit.mjs +0 -160
package/objects/compile.mjs
CHANGED
|
@@ -13,38 +13,43 @@ import {
|
|
|
13
13
|
import { objectToKVMArtifact } from "../kvm.mjs";
|
|
14
14
|
|
|
15
15
|
function helpText() {
|
|
16
|
+
const prog = argv[1] || "compile.mjs";
|
|
16
17
|
return [
|
|
17
|
-
"Compile
|
|
18
|
-
"Output format is inferred from the output
|
|
18
|
+
"Compile k source, .ko, or .klib into .ko, .klib, or .kvm output.",
|
|
19
|
+
"Output format is inferred from the output extension or --format.",
|
|
19
20
|
"",
|
|
20
|
-
`Usage: ${
|
|
21
|
+
`Usage: ${prog} [options]`,
|
|
22
|
+
" [source-snippet | input-file [output-file]]",
|
|
21
23
|
"",
|
|
22
24
|
"Arguments:",
|
|
23
|
-
" source-snippet
|
|
24
|
-
" input-file
|
|
25
|
-
"
|
|
25
|
+
" source-snippet Inline k source, in the same style as k.mjs.",
|
|
26
|
+
" input-file Source .k, .ko, or .klib file.",
|
|
27
|
+
" Reads UTF-8 source from stdin when omitted.",
|
|
28
|
+
" output-file Output path (.ko, .klib, or .kvm).",
|
|
29
|
+
" Writes to stdout when omitted.",
|
|
26
30
|
"",
|
|
27
31
|
"Options:",
|
|
28
|
-
" --
|
|
29
|
-
" --
|
|
30
|
-
"
|
|
31
|
-
" --
|
|
32
|
-
"
|
|
32
|
+
" -o, --output path Specify output file path explicitly.",
|
|
33
|
+
" --format fmt Output format: ko, klib, or kvm.",
|
|
34
|
+
" Overrides extension detection.",
|
|
35
|
+
" --lib file Load one .klib or .k library before compiling.",
|
|
36
|
+
" --export spec Export library alias into scope. Repeatable.",
|
|
37
|
+
" spec is 'name' or 'libname:localname'.",
|
|
38
|
+
" -h, --help Show this help.",
|
|
33
39
|
"",
|
|
34
|
-
"Existing input paths are read as files. A non-existing input with
|
|
35
|
-
"or .klib extension is reported as
|
|
36
|
-
"as inline k source.",
|
|
40
|
+
"Existing input paths are read as files. A non-existing input with",
|
|
41
|
+
".k, .ko, or .klib extension is reported as missing; otherwise it is",
|
|
42
|
+
"compiled as inline k source.",
|
|
37
43
|
"",
|
|
38
44
|
".kvm is a polymorphic kVM template artifact (layer: KVM-P).",
|
|
39
45
|
"A .klib input can only be copied to .klib output.",
|
|
40
46
|
"",
|
|
41
47
|
"Examples:",
|
|
42
|
-
` ${
|
|
43
|
-
` ${
|
|
44
|
-
` ${
|
|
45
|
-
` ${
|
|
46
|
-
` ${
|
|
47
|
-
` ${argv[1]} --lib core.klib --export add --export mul:times program.k program.ko`
|
|
48
|
+
` ${prog} 'x = |x; x x'`,
|
|
49
|
+
` ${prog} program.k -o program.ko`,
|
|
50
|
+
` ${prog} program.k program.klib`,
|
|
51
|
+
` ${prog} program.k program.kvm`,
|
|
52
|
+
` ${prog} --lib core.klib --export add program.k program.ko`
|
|
48
53
|
].join("\n");
|
|
49
54
|
}
|
|
50
55
|
|
|
@@ -144,6 +149,7 @@ try {
|
|
|
144
149
|
|
|
145
150
|
const libraries = [];
|
|
146
151
|
let format = null;
|
|
152
|
+
let explicitOutput = null;
|
|
147
153
|
const exports = [];
|
|
148
154
|
|
|
149
155
|
while (args.length > 0) {
|
|
@@ -151,7 +157,13 @@ try {
|
|
|
151
157
|
args.shift();
|
|
152
158
|
break;
|
|
153
159
|
}
|
|
154
|
-
if (args[0] === "--
|
|
160
|
+
if (args[0] === "-o" || args[0] === "--output") {
|
|
161
|
+
args.shift();
|
|
162
|
+
explicitOutput = args.shift();
|
|
163
|
+
if (!explicitOutput) {
|
|
164
|
+
throw new Error("-o/--output requires a file argument");
|
|
165
|
+
}
|
|
166
|
+
} else if (args[0] === "--lib") {
|
|
155
167
|
args.shift();
|
|
156
168
|
const libPath = args.shift();
|
|
157
169
|
if (!libPath) throw new Error("--lib requires a file argument");
|
|
@@ -172,7 +184,7 @@ try {
|
|
|
172
184
|
format = args.shift();
|
|
173
185
|
if (!["ko", "klib", "kvm"].includes(format))
|
|
174
186
|
throw new Error(`Unknown format: ${format}. Use ko, klib, or kvm.`);
|
|
175
|
-
} else if (args[0].startsWith("
|
|
187
|
+
} else if (args[0].startsWith("-")) {
|
|
176
188
|
throw new Error(`Unknown option: ${args[0]}`);
|
|
177
189
|
} else {
|
|
178
190
|
break;
|
|
@@ -180,11 +192,13 @@ try {
|
|
|
180
192
|
}
|
|
181
193
|
|
|
182
194
|
const inputArg = args.shift() || null;
|
|
183
|
-
const
|
|
195
|
+
const positionalOutput = args.shift() || null;
|
|
184
196
|
if (args.length > 0) {
|
|
185
197
|
throw new Error(`Unexpected argument: ${args[0]}`);
|
|
186
198
|
}
|
|
187
199
|
|
|
200
|
+
const outputPath = explicitOutput || positionalOutput || null;
|
|
201
|
+
|
|
188
202
|
const outputFormat = format || inferFormat(outputPath);
|
|
189
203
|
const input = resolveInput(inputArg);
|
|
190
204
|
const inputType = input.type;
|
package/objects/decompile.mjs
CHANGED
|
@@ -5,20 +5,24 @@ import { argv, exit, stdin, stdout } from "node:process";
|
|
|
5
5
|
import { decompileObjectBuffer } from "../object.mjs";
|
|
6
6
|
|
|
7
7
|
function helpText() {
|
|
8
|
+
const prog = argv[1] || "decompile.mjs";
|
|
8
9
|
return [
|
|
9
10
|
"Decompile a .ko or .klib object into readable k source.",
|
|
10
11
|
"",
|
|
11
|
-
`Usage: ${
|
|
12
|
+
`Usage: ${prog} [options] [ object-file [ k-file ] ]`,
|
|
12
13
|
"",
|
|
13
14
|
"Arguments:",
|
|
14
|
-
" object-file
|
|
15
|
-
"
|
|
15
|
+
" object-file Input .ko or .klib path.",
|
|
16
|
+
" Reads object data from stdin when omitted.",
|
|
17
|
+
" k-file Output .k path (default: stdout).",
|
|
16
18
|
"",
|
|
17
19
|
"Options:",
|
|
18
|
-
" -
|
|
20
|
+
" -o, --output path Specify output file path explicitly.",
|
|
21
|
+
" -h, --help Show this help.",
|
|
19
22
|
"",
|
|
20
|
-
"
|
|
21
|
-
` ${
|
|
23
|
+
"Examples:",
|
|
24
|
+
` ${prog} program.ko -o program.decompiled.k`,
|
|
25
|
+
` ${prog} program.ko program.decompiled.k`
|
|
22
26
|
].join("\n");
|
|
23
27
|
}
|
|
24
28
|
|
|
@@ -35,13 +39,39 @@ async function readStdinBuffer() {
|
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
try {
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
42
|
+
const rawArgs = argv.slice(2);
|
|
43
|
+
if (rawArgs.includes("-h") || rawArgs.includes("--help")) {
|
|
40
44
|
usage(console.log);
|
|
41
45
|
exit(0);
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
let explicitOutput = null;
|
|
49
|
+
const remainingArgs = [];
|
|
50
|
+
while (rawArgs.length > 0) {
|
|
51
|
+
const arg = rawArgs[0];
|
|
52
|
+
if (arg === "-o" || arg === "--output") {
|
|
53
|
+
rawArgs.shift();
|
|
54
|
+
explicitOutput = rawArgs.shift();
|
|
55
|
+
if (!explicitOutput) {
|
|
56
|
+
throw new Error("-o/--output requires a file argument");
|
|
57
|
+
}
|
|
58
|
+
} else if (arg.startsWith("-")) {
|
|
59
|
+
throw new Error(`Unknown option: ${arg}`);
|
|
60
|
+
} else {
|
|
61
|
+
remainingArgs.push(rawArgs.shift());
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const objectPath = remainingArgs.shift() || null;
|
|
66
|
+
const positionalOutput = remainingArgs.shift() || null;
|
|
67
|
+
if (remainingArgs.length > 0) {
|
|
68
|
+
throw new Error(`Unexpected argument: ${remainingArgs[0]}`);
|
|
69
|
+
}
|
|
70
|
+
const outputPath = explicitOutput || positionalOutput || null;
|
|
71
|
+
|
|
72
|
+
const objectBuffer = objectPath == null
|
|
73
|
+
? await readStdinBuffer()
|
|
74
|
+
: fs.readFileSync(objectPath);
|
|
45
75
|
const source = decompileObjectBuffer(objectBuffer);
|
|
46
76
|
if (outputPath == null) {
|
|
47
77
|
stdout.write(source);
|
|
@@ -49,7 +79,7 @@ try {
|
|
|
49
79
|
fs.writeFileSync(outputPath, source);
|
|
50
80
|
}
|
|
51
81
|
} catch (error) {
|
|
52
|
-
console.error(error);
|
|
82
|
+
console.error(error.message || String(error));
|
|
53
83
|
usage();
|
|
54
84
|
exit(1);
|
|
55
85
|
}
|
|
@@ -5,24 +5,28 @@ import { argv, exit, stdin, stdout } from "node:process";
|
|
|
5
5
|
import { extractAliasesFromObjectBuffer } from "../object.mjs";
|
|
6
6
|
|
|
7
7
|
function helpText() {
|
|
8
|
+
const prog = argv[1] || "extract-aliases.mjs";
|
|
8
9
|
return [
|
|
9
|
-
"Extract metadata aliases from a .ko or .klib as
|
|
10
|
+
"Extract metadata aliases from a .ko or .klib as valid k source.",
|
|
10
11
|
"",
|
|
11
|
-
`Usage: ${
|
|
12
|
+
`Usage: ${prog} [options] [ object-file [ k-file ] ]`,
|
|
12
13
|
"",
|
|
13
|
-
"Output is grouped by metadata type (code, then rel), then sorted
|
|
14
|
-
"name and compiledAt. Earlier definitions of the same alias
|
|
15
|
-
"out so only the latest one remains active.",
|
|
14
|
+
"Output is grouped by metadata type (code, then rel), then sorted",
|
|
15
|
+
"by alias name and compiledAt. Earlier definitions of the same alias",
|
|
16
|
+
"are commented out so only the latest one remains active.",
|
|
16
17
|
"",
|
|
17
18
|
"Arguments:",
|
|
18
|
-
" object-file
|
|
19
|
-
"
|
|
19
|
+
" object-file Input .ko or .klib path.",
|
|
20
|
+
" Reads object data from stdin when omitted.",
|
|
21
|
+
" k-file Output .k path (default: stdout).",
|
|
20
22
|
"",
|
|
21
23
|
"Options:",
|
|
22
|
-
" -
|
|
24
|
+
" -o, --output path Specify output file path explicitly.",
|
|
25
|
+
" -h, --help Show this help.",
|
|
23
26
|
"",
|
|
24
|
-
"
|
|
25
|
-
` ${
|
|
27
|
+
"Examples:",
|
|
28
|
+
` ${prog} core.klib -o aliases.k`,
|
|
29
|
+
` ${prog} core.klib aliases.k`
|
|
26
30
|
].join("\n");
|
|
27
31
|
}
|
|
28
32
|
|
|
@@ -39,13 +43,39 @@ async function readStdinBuffer() {
|
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
try {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
46
|
+
const rawArgs = argv.slice(2);
|
|
47
|
+
if (rawArgs.includes("-h") || rawArgs.includes("--help")) {
|
|
44
48
|
usage(console.log);
|
|
45
49
|
exit(0);
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
let explicitOutput = null;
|
|
53
|
+
const remainingArgs = [];
|
|
54
|
+
while (rawArgs.length > 0) {
|
|
55
|
+
const arg = rawArgs[0];
|
|
56
|
+
if (arg === "-o" || arg === "--output") {
|
|
57
|
+
rawArgs.shift();
|
|
58
|
+
explicitOutput = rawArgs.shift();
|
|
59
|
+
if (!explicitOutput) {
|
|
60
|
+
throw new Error("-o/--output requires a file argument");
|
|
61
|
+
}
|
|
62
|
+
} else if (arg.startsWith("-")) {
|
|
63
|
+
throw new Error(`Unknown option: ${arg}`);
|
|
64
|
+
} else {
|
|
65
|
+
remainingArgs.push(rawArgs.shift());
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const objectPath = remainingArgs.shift() || null;
|
|
70
|
+
const positionalOutput = remainingArgs.shift() || null;
|
|
71
|
+
if (remainingArgs.length > 0) {
|
|
72
|
+
throw new Error(`Unexpected argument: ${remainingArgs[0]}`);
|
|
73
|
+
}
|
|
74
|
+
const outputPath = explicitOutput || positionalOutput || null;
|
|
75
|
+
|
|
76
|
+
const objectBuffer = objectPath == null
|
|
77
|
+
? await readStdinBuffer()
|
|
78
|
+
: fs.readFileSync(objectPath);
|
|
49
79
|
const source = extractAliasesFromObjectBuffer(objectBuffer);
|
|
50
80
|
if (outputPath == null) {
|
|
51
81
|
stdout.write(source);
|
|
@@ -53,7 +83,7 @@ try {
|
|
|
53
83
|
fs.writeFileSync(outputPath, source);
|
|
54
84
|
}
|
|
55
85
|
} catch (error) {
|
|
56
|
-
console.error(error);
|
|
86
|
+
console.error(error.message || String(error));
|
|
57
87
|
usage();
|
|
58
88
|
exit(1);
|
|
59
89
|
}
|
package/objects/inspect.mjs
CHANGED
|
@@ -6,20 +6,26 @@ import { decodeObject } from "../object.mjs";
|
|
|
6
6
|
import { objectToKIRP } from "../kir.mjs";
|
|
7
7
|
|
|
8
8
|
function helpText() {
|
|
9
|
+
const prog = argv[1] || "inspect.mjs";
|
|
9
10
|
return [
|
|
10
11
|
"Inspect a k .ko or .klib object.",
|
|
11
12
|
"",
|
|
12
|
-
`Usage: ${
|
|
13
|
+
`Usage: ${prog} [options] [object-file]`,
|
|
13
14
|
"",
|
|
14
15
|
"Arguments:",
|
|
15
|
-
" object-file Input .ko or .klib file
|
|
16
|
+
" object-file Input .ko or .klib file (default: stdin).",
|
|
16
17
|
"",
|
|
17
18
|
"Options:",
|
|
18
19
|
" --kir Print the KIR-P JSON view.",
|
|
19
|
-
" --summary Print a compact section summary
|
|
20
|
+
" --summary Print a compact section summary (default).",
|
|
20
21
|
" -h, --help Show this help.",
|
|
21
22
|
"",
|
|
22
|
-
"KIR-P is an inspection/export view; it does not change the stored
|
|
23
|
+
"KIR-P is an inspection/export view; it does not change the stored",
|
|
24
|
+
"object format.",
|
|
25
|
+
"",
|
|
26
|
+
"Examples:",
|
|
27
|
+
` ${prog} program.ko`,
|
|
28
|
+
` ${prog} --kir program.ko`
|
|
23
29
|
].join("\n");
|
|
24
30
|
}
|
|
25
31
|
|
|
@@ -66,22 +72,21 @@ try {
|
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
let mode = "summary";
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (
|
|
75
|
+
let inputPath = null;
|
|
76
|
+
for (const arg of args) {
|
|
77
|
+
if (arg === "--kir") {
|
|
72
78
|
mode = "kir";
|
|
73
|
-
} else if (
|
|
79
|
+
} else if (arg === "--summary") {
|
|
74
80
|
mode = "summary";
|
|
81
|
+
} else if (arg.startsWith("-")) {
|
|
82
|
+
throw new Error(`Unknown option: ${arg}`);
|
|
83
|
+
} else if (inputPath == null) {
|
|
84
|
+
inputPath = arg;
|
|
75
85
|
} else {
|
|
76
|
-
throw new Error(`
|
|
86
|
+
throw new Error(`Unexpected argument: ${arg}`);
|
|
77
87
|
}
|
|
78
88
|
}
|
|
79
89
|
|
|
80
|
-
const inputPath = args.shift() || null;
|
|
81
|
-
if (args.length > 0) {
|
|
82
|
-
throw new Error(`Unexpected argument: ${args[0]}`);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
90
|
const buffer = inputPath == null ? await readStdinBytes() : fs.readFileSync(inputPath);
|
|
86
91
|
const object = decodeObject(buffer);
|
|
87
92
|
if (mode === "kir") {
|
package/objects/validate.mjs
CHANGED
|
@@ -346,19 +346,25 @@ export function validateKIRP(kir) {
|
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
function helpText() {
|
|
349
|
+
const prog = argv[1] || "validate.mjs";
|
|
349
350
|
return [
|
|
350
351
|
"Validate a k .ko/.klib object or KIR-P JSON file.",
|
|
351
352
|
"",
|
|
352
|
-
`Usage: ${
|
|
353
|
+
`Usage: ${prog} [options] [input-file]`,
|
|
353
354
|
"",
|
|
354
355
|
"Arguments:",
|
|
355
|
-
" input-file Input .ko/.klib file, or KIR JSON with --kir.
|
|
356
|
+
" input-file Input .ko/.klib file, or KIR JSON with --kir.",
|
|
357
|
+
" Reads stdin when omitted.",
|
|
356
358
|
"",
|
|
357
359
|
"Options:",
|
|
358
|
-
" --kir Validate input as KIR-P JSON instead of
|
|
360
|
+
" --kir Validate input as KIR-P JSON instead of an object.",
|
|
359
361
|
" -h, --help Show this help.",
|
|
360
362
|
"",
|
|
361
|
-
"Object validation also validates the derived KIR-P export view."
|
|
363
|
+
"Object validation also validates the derived KIR-P export view.",
|
|
364
|
+
"",
|
|
365
|
+
"Examples:",
|
|
366
|
+
` ${prog} program.ko`,
|
|
367
|
+
` ${prog} --kir program.kir.json`
|
|
362
368
|
].join("\n");
|
|
363
369
|
}
|
|
364
370
|
|
|
@@ -382,18 +388,19 @@ async function main() {
|
|
|
382
388
|
}
|
|
383
389
|
|
|
384
390
|
let mode = "object";
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if (
|
|
391
|
+
let inputPath = null;
|
|
392
|
+
for (const arg of args) {
|
|
393
|
+
if (arg === "--kir") {
|
|
388
394
|
mode = "kir";
|
|
395
|
+
} else if (arg.startsWith("-")) {
|
|
396
|
+
throw new Error(`Unknown option: ${arg}`);
|
|
397
|
+
} else if (inputPath == null) {
|
|
398
|
+
inputPath = arg;
|
|
389
399
|
} else {
|
|
390
|
-
throw new Error(`
|
|
400
|
+
throw new Error(`Unexpected argument: ${arg}`);
|
|
391
401
|
}
|
|
392
402
|
}
|
|
393
403
|
|
|
394
|
-
const inputPath = args.shift() || null;
|
|
395
|
-
if (args.length > 0) throw new Error(`Unexpected argument: ${args[0]}`);
|
|
396
|
-
|
|
397
404
|
const input = inputPath == null ? await readStdinBytes() : fs.readFileSync(inputPath);
|
|
398
405
|
if (mode === "kir") {
|
|
399
406
|
validateKIRP(JSON.parse(input.toString("utf8")));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fraczak/k",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "k — a language for content-addressable schemas and data transformations over algebraic data types (products and tagged unions); includes runtime, contract derivation, REPL, and codec toolchain",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -21,9 +21,17 @@
|
|
|
21
21
|
"benchmark:html": "node scripts/render-benchmark.mjs",
|
|
22
22
|
"perf:ieee": "node scripts/perf-ieee.mjs",
|
|
23
23
|
"perf:ieee:full": "node scripts/perf-ieee.mjs --full",
|
|
24
|
+
"perf:ieee:pkir": "BACKENDS=pkir node scripts/perf-ieee.mjs",
|
|
25
|
+
"perf:ieee:llvm-pkir": "BACKENDS=llvm-pkir node scripts/perf-ieee.mjs",
|
|
24
26
|
"perf:int": "node scripts/perf-int.mjs",
|
|
27
|
+
"perf:int:pkir": "BACKENDS=pkir node scripts/perf-int.mjs",
|
|
28
|
+
"perf:int:llvm-pkir": "BACKENDS=llvm-pkir node scripts/perf-int.mjs",
|
|
25
29
|
"perf:mult": "node scripts/perf-multiplication.mjs",
|
|
30
|
+
"perf:mult:pkir": "node scripts/perf-multiplication.mjs --backends pkir",
|
|
31
|
+
"perf:mult:llvm-pkir": "node scripts/perf-multiplication.mjs --backends llvm-pkir",
|
|
26
32
|
"perf:poly": "node scripts/perf-poly.mjs",
|
|
33
|
+
"perf:poly:pkir": "BACKENDS=pkir node scripts/perf-poly.mjs",
|
|
34
|
+
"perf:poly:llvm-pkir": "BACKENDS=llvm-pkir node scripts/perf-poly.mjs",
|
|
27
35
|
"perf:poly:trace": "node scripts/perf-poly.mjs --trace",
|
|
28
36
|
"perf:idempotency": "node scripts/benchmark-idempotency.mjs",
|
|
29
37
|
"deps:graph": "node scripts/generate-dependency-graph.mjs",
|
|
@@ -44,13 +52,13 @@
|
|
|
44
52
|
"k-inspect-object": "objects/inspect.mjs",
|
|
45
53
|
"k-validate-object": "objects/validate.mjs",
|
|
46
54
|
"k-kir": "kir.mjs",
|
|
55
|
+
"k-llvm": "backends/llvm/bin/k-llvm.mjs",
|
|
47
56
|
"k-llvm-build": "backends/llvm/bin/k-llvm-build.mjs",
|
|
48
57
|
"k-llvm-compile": "backends/llvm/bin/k-llvm-compile.mjs",
|
|
49
|
-
"k-llvm-jit": "backends/llvm/bin/k-llvm-jit.mjs",
|
|
50
|
-
"k-llvm-run": "backends/llvm/bin/k-llvm-run.mjs",
|
|
51
58
|
"k-wasm": "backends/wasm/bin/k-wasm.mjs",
|
|
52
59
|
"k-wasm-compile": "backends/wasm/bin/k-wasm-compile.mjs",
|
|
53
60
|
"k-wasm-run": "backends/wasm/bin/k-wasm-run.mjs",
|
|
61
|
+
"k-djson": "codecs/djson.mjs",
|
|
54
62
|
"k-ieee": "codecs/ieee.mjs",
|
|
55
63
|
"k-int": "codecs/int.mjs",
|
|
56
64
|
"k-json": "codecs/json.mjs",
|