@fraczak/k 6.3.3 → 6.5.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 +17 -0
- package/DOCS/CODECS.md +258 -0
- package/DOCS/DICTIONARY.md +1172 -0
- package/DOCS/KIR_SPECIALIZATION_DESIGN.md +51 -46
- package/DOCS/KIR_V1.md +221 -0
- package/DOCS/KVM_EXECUTION_MODEL.md +56 -19
- package/DOCS/OBJECT_FILE_AND_PATTERN.md +2 -1
- package/DOCS/PROFILING_AND_TRACING.md +196 -0
- package/DOCS/REPL.md +61 -4
- package/DOCS/WEB_REPL_REQUIREMENTS.md +135 -0
- package/DOCS/dependency-graph.md +144 -0
- package/Examples/arithmetics.k +108 -82
- package/Examples/bnat.k +1 -1
- package/Examples/buda.k +44 -0
- package/Examples/ieee.k +300 -8671
- package/Examples/poly.k +67 -0
- package/README.md +68 -19
- package/Value.mjs +8 -2
- package/augmentation.mjs +9 -7
- package/backend-api.mjs +11 -2
- package/backends/arm64/README.md +104 -0
- package/backends/arm64/bin/k-arm64-compile.mjs +101 -0
- package/backends/arm64/bin/k-arm64-run.mjs +58 -0
- package/backends/arm64/bin/k-arm64.mjs +88 -0
- package/backends/arm64/scripts/run-tests.mjs +41 -0
- package/backends/arm64/src/arm64.mjs +229 -0
- package/backends/arm64/src/cli.mjs +155 -0
- package/backends/arm64/src/kvm2arm64.mjs +906 -0
- package/backends/arm64/src/runtime.c +728 -0
- package/backends/arm64/tests/integration.sh +112 -0
- package/backends/arm64/tests/test-arm64.mjs +240 -0
- package/backends/llvm/README.md +135 -0
- package/backends/llvm/bin/k-llvm-build.mjs +71 -0
- package/backends/llvm/bin/k-llvm-compile.mjs +68 -0
- package/backends/llvm/bin/k-llvm-jit.mjs +160 -0
- package/backends/llvm/bin/k-llvm-run.mjs +90 -0
- package/backends/llvm/runtime/krt.c +1508 -0
- package/backends/llvm/runtime/krt.h +109 -0
- package/backends/llvm/scripts/conformance.mjs +76 -0
- package/backends/llvm/scripts/run-tests.mjs +28 -0
- package/backends/llvm/src/executable.mjs +562 -0
- package/backends/llvm/src/kvm2llvm.mjs +998 -0
- package/backends/llvm/src/llvm.mjs +1092 -0
- package/backends/llvm/tests/composition-driver.c +22 -0
- package/backends/llvm/tests/identity-driver.c +27 -0
- package/backends/llvm/tests/integration.sh +153 -0
- package/backends/llvm/tests/perf-support.mjs +735 -0
- package/backends/llvm/tests/product-driver.c +23 -0
- package/backends/llvm/tests/projection-driver.c +19 -0
- package/backends/llvm/tests/relation-driver.c +29 -0
- package/backends/llvm/tests/test-llvm.mjs +240 -0
- package/backends/llvm/tests/union-driver.c +31 -0
- package/backends/llvm/tests/variant-driver.c +19 -0
- package/backends/llvm/tests/variant-projection-driver.c +21 -0
- package/backends/wasm/DOCS/USE-WEB-ASSEMBLY.md +233 -0
- package/backends/wasm/README.md +97 -0
- package/backends/wasm/TECHNICAL-DEBT.md +58 -0
- package/backends/wasm/bin/k-wasm-compile.mjs +50 -0
- package/backends/wasm/bin/k-wasm-run.mjs +140 -0
- package/backends/wasm/bin/k-wasm.mjs +49 -0
- package/backends/wasm/demo_ieee.mjs +319 -0
- package/backends/wasm/runtime.wat +475 -0
- package/backends/wasm/scripts/run-tests.mjs +41 -0
- package/backends/wasm/src/cli.mjs +133 -0
- package/backends/wasm/src/kvm2wasm.mjs +697 -0
- package/backends/wasm/src/wasm.mjs +1054 -0
- package/backends/wasm/tests/integration.sh +182 -0
- package/backends/wasm/tests/perf-support.mjs +336 -0
- package/backends/wasm/tests/test-wasm.mjs +625 -0
- package/browser/repl-browser.mjs +1584 -0
- package/browser/shims/assert.mjs +19 -0
- package/browser/shims/buffer.mjs +224 -0
- package/browser/shims/crypto.mjs +103 -0
- package/browser/shims/fs.mjs +159 -0
- package/browser/shims/os.mjs +17 -0
- package/browser/shims/path.mjs +54 -0
- package/browser/shims/process.mjs +44 -0
- package/browser/shims/readline.mjs +11 -0
- package/browser/shims/url.mjs +12 -0
- package/browser/vfs-data.mjs +19 -0
- package/codecs/README.md +3 -0
- package/codecs/runtime/show-value.mjs +12 -3
- package/conformance/helper-reuse/case.json +8 -0
- package/conformance/helper-reuse/expected.kv +1 -0
- package/conformance/helper-reuse/input.kv +1 -0
- package/conformance/helper-reuse/program.k +2 -0
- package/conformance/identity/case.json +8 -0
- package/conformance/identity/expected.kv +1 -0
- package/conformance/identity/input.kv +1 -0
- package/conformance/identity/program.k +1 -0
- package/conformance/product-projection/case.json +8 -0
- package/conformance/product-projection/expected.kv +1 -0
- package/conformance/product-projection/input.kv +1 -0
- package/conformance/product-projection/program.k +1 -0
- package/conformance/run.mjs +149 -0
- package/conformance/variant-construction/case.json +8 -0
- package/conformance/variant-construction/expected.kv +1 -0
- package/conformance/variant-construction/input.kv +1 -0
- package/conformance/variant-construction/program.k +1 -0
- package/harness/adapters/arm64.mjs +105 -0
- package/harness/adapters/kvm.mjs +144 -0
- package/harness/adapters/llvm.mjs +118 -0
- package/harness/adapters/native.mjs +77 -0
- package/harness/adapters/wasm.mjs +169 -0
- package/harness/backend.mjs +95 -0
- package/harness/cli.mjs +130 -0
- package/harness/format.mjs +95 -0
- package/harness/index.mjs +25 -0
- package/harness/persistent.mjs +121 -0
- package/harness/registry.mjs +44 -0
- package/harness/suite.mjs +257 -0
- package/harness/suites/poly.mjs +156 -0
- package/harness/trace.mjs +50 -0
- package/harness/util.mjs +92 -0
- package/intrinsics.mjs +41 -0
- package/kir.mjs +399 -0
- package/kvm.mjs +585 -81
- package/objects/README.md +37 -3
- package/objects/compile.mjs +15 -22
- package/objects/inspect.mjs +96 -0
- package/objects/validate.mjs +415 -0
- package/package.json +51 -19
- package/repl-codecs.mjs +105 -6
- package/repl.mjs +335 -49
- package/run.mjs +2 -7
- package/scripts/benchmark.mjs +406 -22
- package/scripts/build-repl-html.mjs +1784 -0
- package/scripts/perf-ieee.mjs +586 -0
- package/scripts/perf-int.mjs +531 -0
- package/scripts/perf-poly.mjs +945 -0
- package/scripts/render-benchmark.mjs +12 -8
- package/scripts/run-tests.mjs +6 -0
- package/tests/integration.sh +19 -2
- package/tests/test-arithmetics.mjs +54 -0
- package/tests/test-ieee-arithmetic.mjs +4 -0
- package/tests/test-kir.mjs +85 -0
- package/tests/test-kvm-polymorphic.mjs +278 -0
- package/tests/test-kvm.mjs +25 -6
- package/tests/test-poly.mjs +129 -0
- package/tests/test-repl-html.mjs +303 -0
- package/tests/test-repl.mjs +144 -1
- package/tests/test-validate-object.mjs +40 -0
- package/a.klib +0 -1
- package/a.kvm +0 -142676
- package/a.wasm +0 -0
- package/benchmark-results.html +0 -532
- package/benchmark-results.json +0 -480
- package/k-vscode/.vscode/launch.json +0 -14
- package/k-vscode/README.md +0 -75
- package/k-vscode/extension.js +0 -273
- package/k-vscode/language-configuration.json +0 -42
- package/k-vscode/package.json +0 -79
- package/k-vscode/snippets/k.json +0 -92
- package/k-vscode/syntaxes/k.tmLanguage.json +0 -599
- package/k-vscode/test/background-ranges.test.js +0 -50
- package/k-vscode/themes/k-contrast-color-theme.json +0 -104
- package/scripts/git-hooks/pre-commit +0 -10
package/k-vscode/extension.js
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
const vscode = require("vscode");
|
|
2
|
-
|
|
3
|
-
const NAME_START = /[a-zA-Z0-9_+\-]/;
|
|
4
|
-
const NAME_PART = /[a-zA-Z0-9_?!+\-]/;
|
|
5
|
-
const OPEN_TO_CLOSE = new Map([
|
|
6
|
-
["{", "}"],
|
|
7
|
-
["<", ">"],
|
|
8
|
-
["(", ")"]
|
|
9
|
-
]);
|
|
10
|
-
const CLOSERS = new Set(OPEN_TO_CLOSE.values());
|
|
11
|
-
|
|
12
|
-
function lex(text) {
|
|
13
|
-
const tokens = [];
|
|
14
|
-
let index = 0;
|
|
15
|
-
|
|
16
|
-
while (index < text.length) {
|
|
17
|
-
const char = text[index];
|
|
18
|
-
const next = text[index + 1];
|
|
19
|
-
|
|
20
|
-
if (/\s/.test(char)) {
|
|
21
|
-
index++;
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (char === "/" && next === "*") {
|
|
26
|
-
const end = text.indexOf("*/", index + 2);
|
|
27
|
-
index = end === -1 ? text.length : end + 2;
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
(char === "/" && next === "/") ||
|
|
33
|
-
(char === "-" && next === "-") ||
|
|
34
|
-
(char === "\\" && next === "\\") ||
|
|
35
|
-
char === "#" ||
|
|
36
|
-
char === "%"
|
|
37
|
-
) {
|
|
38
|
-
const end = text.indexOf("\n", index + 1);
|
|
39
|
-
index = end === -1 ? text.length : end + 1;
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (char === "\"" || char === "'") {
|
|
44
|
-
const start = index++;
|
|
45
|
-
while (index < text.length) {
|
|
46
|
-
const current = text[index++];
|
|
47
|
-
if (current === "\\") {
|
|
48
|
-
index++;
|
|
49
|
-
} else if (current === char) {
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
tokens.push({ value: text.slice(start, index), start, end: index });
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (NAME_START.test(char)) {
|
|
58
|
-
const start = index++;
|
|
59
|
-
while (index < text.length && NAME_PART.test(text[index])) index++;
|
|
60
|
-
tokens.push({ value: text.slice(start, index), start, end: index });
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
tokens.push({ value: char, start: index, end: index + 1 });
|
|
65
|
-
index++;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return tokens;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function isName(token) {
|
|
72
|
-
return token != null && NAME_START.test(token.value[0]);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function findDefinitionEnd(tokens, startIndex) {
|
|
76
|
-
const stack = [];
|
|
77
|
-
|
|
78
|
-
for (let index = startIndex; index < tokens.length; index++) {
|
|
79
|
-
const value = tokens[index].value;
|
|
80
|
-
const closer = OPEN_TO_CLOSE.get(value);
|
|
81
|
-
if (closer) {
|
|
82
|
-
stack.push(closer);
|
|
83
|
-
} else if (CLOSERS.has(value)) {
|
|
84
|
-
if (value !== stack.at(-1)) return -1;
|
|
85
|
-
stack.pop();
|
|
86
|
-
} else if (value === ";" && stack.length === 0) {
|
|
87
|
-
return index;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return -1;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function findMatching(tokens, startIndex) {
|
|
95
|
-
const firstCloser = OPEN_TO_CLOSE.get(tokens[startIndex]?.value);
|
|
96
|
-
if (!firstCloser) return -1;
|
|
97
|
-
|
|
98
|
-
const stack = [firstCloser];
|
|
99
|
-
for (let index = startIndex + 1; index < tokens.length; index++) {
|
|
100
|
-
const value = tokens[index].value;
|
|
101
|
-
const closer = OPEN_TO_CLOSE.get(value);
|
|
102
|
-
if (closer) {
|
|
103
|
-
stack.push(closer);
|
|
104
|
-
} else if (CLOSERS.has(value)) {
|
|
105
|
-
if (value !== stack.at(-1)) return -1;
|
|
106
|
-
stack.pop();
|
|
107
|
-
if (stack.length === 0) return index;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return -1;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function parseCodeEnd(tokens, startIndex) {
|
|
115
|
-
const token = tokens[startIndex];
|
|
116
|
-
if (!token) return -1;
|
|
117
|
-
|
|
118
|
-
if (isName(token)) return startIndex + 1;
|
|
119
|
-
|
|
120
|
-
if (token.value === "@" && isName(tokens[startIndex + 1])) {
|
|
121
|
-
return startIndex + 2;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (token.value === "{" || token.value === "<") {
|
|
125
|
-
const matching = findMatching(tokens, startIndex);
|
|
126
|
-
return matching === -1 ? -1 : matching + 1;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return -1;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function parseFilterEnd(tokens, startIndex) {
|
|
133
|
-
const token = tokens[startIndex];
|
|
134
|
-
if (!token) return -1;
|
|
135
|
-
|
|
136
|
-
let endIndex;
|
|
137
|
-
if (token.value === "$") {
|
|
138
|
-
endIndex = parseCodeEnd(tokens, startIndex + 1);
|
|
139
|
-
} else if (token.value === "(" || token.value === "{" || token.value === "<") {
|
|
140
|
-
const matching = findMatching(tokens, startIndex);
|
|
141
|
-
endIndex = matching === -1 ? -1 : matching + 1;
|
|
142
|
-
} else if (isName(token)) {
|
|
143
|
-
endIndex = startIndex + 1;
|
|
144
|
-
} else {
|
|
145
|
-
return -1;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (
|
|
149
|
-
endIndex !== -1 &&
|
|
150
|
-
tokens[endIndex]?.value === "=" &&
|
|
151
|
-
isName(tokens[endIndex + 1])
|
|
152
|
-
) {
|
|
153
|
-
endIndex += 2;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return endIndex;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function collectBackgroundRanges(text) {
|
|
160
|
-
const tokens = lex(text);
|
|
161
|
-
const type = [];
|
|
162
|
-
const filter = [];
|
|
163
|
-
|
|
164
|
-
let index = tokens[0]?.value === "~" ? 1 : 0;
|
|
165
|
-
while (index < tokens.length) {
|
|
166
|
-
const isTypeDefinition =
|
|
167
|
-
tokens[index]?.value === "$" &&
|
|
168
|
-
isName(tokens[index + 1]) &&
|
|
169
|
-
tokens[index + 2]?.value === "=";
|
|
170
|
-
const isRelationDefinition =
|
|
171
|
-
isName(tokens[index]) &&
|
|
172
|
-
tokens[index + 1]?.value === "=";
|
|
173
|
-
|
|
174
|
-
if (!isTypeDefinition && !isRelationDefinition) break;
|
|
175
|
-
|
|
176
|
-
const equalsIndex = index + (isTypeDefinition ? 2 : 1);
|
|
177
|
-
const endIndex = findDefinitionEnd(tokens, equalsIndex + 1);
|
|
178
|
-
if (endIndex === -1) break;
|
|
179
|
-
|
|
180
|
-
if (isTypeDefinition) {
|
|
181
|
-
type.push({
|
|
182
|
-
start: tokens[index].start,
|
|
183
|
-
end: tokens[endIndex].end
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
index = endIndex + 1;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
for (let tokenIndex = 0; tokenIndex < tokens.length; tokenIndex++) {
|
|
190
|
-
if (tokens[tokenIndex].value === "?") {
|
|
191
|
-
const endIndex = parseFilterEnd(tokens, tokenIndex + 1);
|
|
192
|
-
if (endIndex !== -1) {
|
|
193
|
-
filter.push({
|
|
194
|
-
start: tokens[tokenIndex].start,
|
|
195
|
-
end: tokens[endIndex - 1].end
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
if (tokens[tokenIndex].value !== "$") continue;
|
|
202
|
-
|
|
203
|
-
const isDefinition =
|
|
204
|
-
isName(tokens[tokenIndex + 1]) &&
|
|
205
|
-
tokens[tokenIndex + 2]?.value === "=";
|
|
206
|
-
if (isDefinition) continue;
|
|
207
|
-
|
|
208
|
-
const endIndex = parseCodeEnd(tokens, tokenIndex + 1);
|
|
209
|
-
if (endIndex !== -1) {
|
|
210
|
-
type.push({
|
|
211
|
-
start: tokens[tokenIndex].start,
|
|
212
|
-
end: tokens[endIndex - 1].end
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return { type, filter };
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
function toVscodeRanges(document, ranges) {
|
|
221
|
-
return ranges.map(({ start, end }) => new vscode.Range(
|
|
222
|
-
document.positionAt(start),
|
|
223
|
-
document.positionAt(end)
|
|
224
|
-
));
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function activate(context) {
|
|
228
|
-
const filterDecoration = vscode.window.createTextEditorDecorationType({
|
|
229
|
-
backgroundColor: "rgba(58, 45, 32, 0.82)"
|
|
230
|
-
});
|
|
231
|
-
const typeDecoration = vscode.window.createTextEditorDecorationType({
|
|
232
|
-
backgroundColor: "rgba(38, 53, 39, 0.92)"
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
context.subscriptions.push(filterDecoration, typeDecoration);
|
|
236
|
-
|
|
237
|
-
function updateEditor(editor) {
|
|
238
|
-
if (editor.document.languageId !== "k") return;
|
|
239
|
-
|
|
240
|
-
const ranges = collectBackgroundRanges(editor.document.getText());
|
|
241
|
-
editor.setDecorations(
|
|
242
|
-
filterDecoration,
|
|
243
|
-
toVscodeRanges(editor.document, ranges.filter)
|
|
244
|
-
);
|
|
245
|
-
editor.setDecorations(
|
|
246
|
-
typeDecoration,
|
|
247
|
-
toVscodeRanges(editor.document, ranges.type)
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
function updateVisibleEditors() {
|
|
252
|
-
for (const editor of vscode.window.visibleTextEditors) updateEditor(editor);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
context.subscriptions.push(
|
|
256
|
-
vscode.window.onDidChangeVisibleTextEditors(updateVisibleEditors),
|
|
257
|
-
vscode.workspace.onDidChangeTextDocument(({ document }) => {
|
|
258
|
-
for (const editor of vscode.window.visibleTextEditors) {
|
|
259
|
-
if (editor.document === document) updateEditor(editor);
|
|
260
|
-
}
|
|
261
|
-
})
|
|
262
|
-
);
|
|
263
|
-
|
|
264
|
-
updateVisibleEditors();
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
function deactivate() {}
|
|
268
|
-
|
|
269
|
-
module.exports = {
|
|
270
|
-
activate,
|
|
271
|
-
collectBackgroundRanges,
|
|
272
|
-
deactivate
|
|
273
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"comments": {
|
|
3
|
-
"lineComment": "--",
|
|
4
|
-
"blockComment": ["/*", "*/"]
|
|
5
|
-
},
|
|
6
|
-
"brackets": [
|
|
7
|
-
["{", "}"],
|
|
8
|
-
["(", ")"],
|
|
9
|
-
["<", ">"]
|
|
10
|
-
],
|
|
11
|
-
"autoClosingPairs": [
|
|
12
|
-
{ "open": "{", "close": "}" },
|
|
13
|
-
{ "open": "(", "close": ")" },
|
|
14
|
-
{ "open": "<", "close": ">" },
|
|
15
|
-
{ "open": "\"", "close": "\"" },
|
|
16
|
-
{ "open": "'", "close": "'" },
|
|
17
|
-
{ "open": "/*", "close": "*/" }
|
|
18
|
-
],
|
|
19
|
-
"surroundingPairs": [
|
|
20
|
-
["{", "}"],
|
|
21
|
-
["(", ")"],
|
|
22
|
-
["<", ">"],
|
|
23
|
-
["\"", "\""],
|
|
24
|
-
["'", "'"]
|
|
25
|
-
],
|
|
26
|
-
"wordPattern": "[a-zA-Z0-9_+\\-][a-zA-Z0-9_?!+\\-]*",
|
|
27
|
-
"indentationRules": {
|
|
28
|
-
"increaseIndentPattern": "[{(<]\\s*$",
|
|
29
|
-
"decreaseIndentPattern": "^\\s*[})>]"
|
|
30
|
-
},
|
|
31
|
-
"onEnterRules": [
|
|
32
|
-
{
|
|
33
|
-
"beforeText": "/\\*.*\\*/$",
|
|
34
|
-
"action": { "indent": "none" }
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"beforeText": "/\\*",
|
|
38
|
-
"afterText": "\\*/",
|
|
39
|
-
"action": { "indent": "indentOutdent" }
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
}
|
package/k-vscode/package.json
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "k-language",
|
|
3
|
-
"displayName": "k language",
|
|
4
|
-
"description": "Syntax highlighting and snippets for the k language — first-order partial functions over algebraic data types",
|
|
5
|
-
"publisher": "wojtek",
|
|
6
|
-
"version": "0.2.0",
|
|
7
|
-
"license": "ISC",
|
|
8
|
-
"homepage": "https://github.com/fraczak/k",
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "https://github.com/fraczak/k.git"
|
|
12
|
-
},
|
|
13
|
-
"keywords": [
|
|
14
|
-
"k",
|
|
15
|
-
"algebraic",
|
|
16
|
-
"partial functions",
|
|
17
|
-
"ADT",
|
|
18
|
-
"types"
|
|
19
|
-
],
|
|
20
|
-
"engines": {
|
|
21
|
-
"vscode": "^1.90.0"
|
|
22
|
-
},
|
|
23
|
-
"categories": [
|
|
24
|
-
"Programming Languages"
|
|
25
|
-
],
|
|
26
|
-
"main": "./extension.js",
|
|
27
|
-
"activationEvents": [
|
|
28
|
-
"onLanguage:k"
|
|
29
|
-
],
|
|
30
|
-
"files": [
|
|
31
|
-
"extension.js",
|
|
32
|
-
"language-configuration.json",
|
|
33
|
-
"README.md",
|
|
34
|
-
"snippets/k.json",
|
|
35
|
-
"syntaxes/k.tmLanguage.json",
|
|
36
|
-
"themes/k-contrast-color-theme.json"
|
|
37
|
-
],
|
|
38
|
-
"scripts": {
|
|
39
|
-
"test": "node test/background-ranges.test.js"
|
|
40
|
-
},
|
|
41
|
-
"contributes": {
|
|
42
|
-
"languages": [
|
|
43
|
-
{
|
|
44
|
-
"id": "k",
|
|
45
|
-
"aliases": [
|
|
46
|
-
"k language",
|
|
47
|
-
"k"
|
|
48
|
-
],
|
|
49
|
-
"extensions": [
|
|
50
|
-
".k"
|
|
51
|
-
],
|
|
52
|
-
"configuration": "./language-configuration.json"
|
|
53
|
-
}
|
|
54
|
-
],
|
|
55
|
-
"grammars": [
|
|
56
|
-
{
|
|
57
|
-
"language": "k",
|
|
58
|
-
"scopeName": "source.k",
|
|
59
|
-
"path": "./syntaxes/k.tmLanguage.json"
|
|
60
|
-
}
|
|
61
|
-
],
|
|
62
|
-
"themes": [
|
|
63
|
-
{
|
|
64
|
-
"label": "k Contrast",
|
|
65
|
-
"uiTheme": "vs-dark",
|
|
66
|
-
"path": "./themes/k-contrast-color-theme.json"
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
"snippets": [
|
|
70
|
-
{
|
|
71
|
-
"language": "k",
|
|
72
|
-
"path": "./snippets/k.json"
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
"devDependencies": {
|
|
77
|
-
"@vscode/vsce": "^3.7.1"
|
|
78
|
-
}
|
|
79
|
-
}
|
package/k-vscode/snippets/k.json
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Code definition (union)": {
|
|
3
|
-
"prefix": "codeunion",
|
|
4
|
-
"body": ["\\$ ${1:name} = < ${2:type1} ${3:tag1}, ${4:type2} ${5:tag2} >;"],
|
|
5
|
-
"description": "Named code (type) using a tagged union"
|
|
6
|
-
},
|
|
7
|
-
"Code definition (product)": {
|
|
8
|
-
"prefix": "codeprod",
|
|
9
|
-
"body": ["\\$ ${1:name} = { ${2:type1} ${3:label1}, ${4:type2} ${5:label2} };"],
|
|
10
|
-
"description": "Named code (type) using a product (record)"
|
|
11
|
-
},
|
|
12
|
-
"Code definition (recursive union)": {
|
|
13
|
-
"prefix": "coderecunion",
|
|
14
|
-
"body": [
|
|
15
|
-
"\\$ ${1:name} = <",
|
|
16
|
-
" {} ${2:base_tag},",
|
|
17
|
-
" { ${1:name} ${3:field} } ${4:rec_tag}",
|
|
18
|
-
">;"
|
|
19
|
-
],
|
|
20
|
-
"description": "Recursive named code as a tagged union (e.g. nat, list)"
|
|
21
|
-
},
|
|
22
|
-
"Function definition": {
|
|
23
|
-
"prefix": "fn",
|
|
24
|
-
"body": ["${1:name} = ${2:expr};"],
|
|
25
|
-
"description": "Function/relation definition"
|
|
26
|
-
},
|
|
27
|
-
"Composition": {
|
|
28
|
-
"prefix": "comp",
|
|
29
|
-
"body": ["(${1:f} ${2:g})"],
|
|
30
|
-
"description": "Function composition: apply f then g"
|
|
31
|
-
},
|
|
32
|
-
"Merge": {
|
|
33
|
-
"prefix": "merge",
|
|
34
|
-
"body": ["< ${1:f}, ${2:g} >"],
|
|
35
|
-
"description": "Merge: try f first, fall back to g"
|
|
36
|
-
},
|
|
37
|
-
"Product combinator": {
|
|
38
|
-
"prefix": "prod",
|
|
39
|
-
"body": ["{ ${1:f} ${2:label1}, ${3:g} ${4:label2} }"],
|
|
40
|
-
"description": "Product combinator: apply functions in parallel, collect into a record"
|
|
41
|
-
},
|
|
42
|
-
"Filter (union)": {
|
|
43
|
-
"prefix": "filtunion",
|
|
44
|
-
"body": ["?< ${1:type1} ${2:tag1}, ${3:type2} ${4:tag2} > = ${5:X}"],
|
|
45
|
-
"description": "Filter expression constraining a union type, binding the subtype variable"
|
|
46
|
-
},
|
|
47
|
-
"Filter (product)": {
|
|
48
|
-
"prefix": "filtprod",
|
|
49
|
-
"body": ["?{ ${1:Type} ${2:field}, ${3:...} } = ${4:X}"],
|
|
50
|
-
"description": "Filter expression constraining a product type, binding the subtype variable"
|
|
51
|
-
},
|
|
52
|
-
"Product projection": {
|
|
53
|
-
"prefix": "dot",
|
|
54
|
-
"body": [".${1:field}"],
|
|
55
|
-
"description": "Product field projection: .field"
|
|
56
|
-
},
|
|
57
|
-
"Union tag projection": {
|
|
58
|
-
"prefix": "slash",
|
|
59
|
-
"body": ["/${1:tag}"],
|
|
60
|
-
"description": "Union tag projection (assert and unwrap): /tag"
|
|
61
|
-
},
|
|
62
|
-
"Variant introduction": {
|
|
63
|
-
"prefix": "vid",
|
|
64
|
-
"body": ["|${1:tag}"],
|
|
65
|
-
"description": "Variant (tagged union) introduction: |tag"
|
|
66
|
-
},
|
|
67
|
-
"Type annotation": {
|
|
68
|
-
"prefix": "typeref",
|
|
69
|
-
"body": ["\\$${1:typename}"],
|
|
70
|
-
"description": "Type annotation: pin expression output to a named code"
|
|
71
|
-
},
|
|
72
|
-
"Typed input constraint": {
|
|
73
|
-
"prefix": "typedprod",
|
|
74
|
-
"body": ["\\${ ${1:type1} ${2:field1}, ${3:type2} ${4:field2} }"],
|
|
75
|
-
"description": "Typed product input constraint: ${ type label, ... }"
|
|
76
|
-
},
|
|
77
|
-
"Identity": {
|
|
78
|
-
"prefix": "id",
|
|
79
|
-
"body": ["()"],
|
|
80
|
-
"description": "Identity function: pass value through unchanged"
|
|
81
|
-
},
|
|
82
|
-
"Empty product (unit leaf)": {
|
|
83
|
-
"prefix": "unit",
|
|
84
|
-
"body": ["{}"],
|
|
85
|
-
"description": "Empty product: the only leaf value in non-recursive definitions"
|
|
86
|
-
},
|
|
87
|
-
"Always undefined": {
|
|
88
|
-
"prefix": "undef",
|
|
89
|
-
"body": ["<>"],
|
|
90
|
-
"description": "Empty merge: always undefined (bottom)"
|
|
91
|
-
}
|
|
92
|
-
}
|