@fraczak/k 6.2.2 → 6.2.4
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/AGENTS.md +1 -1
- package/CHANGELOG.md +11 -0
- package/CLAUDE.md +1 -1
- package/DOCS/OBJECT_FILE_AND_PATTERN.md +10 -7
- package/README.md +6 -5
- package/a.klib +1 -0
- package/k.mjs +62 -16
- package/kvm.mjs +2 -1
- package/objects/README.md +7 -17
- package/objects/compile.mjs +214 -24
- package/package.json +1 -2
- package/run.mjs +25 -26
- package/scripts/benchmark-idempotency.mjs +3 -3
- package/tests/integration.sh +44 -2
- package/objects/compile-lib.mjs +0 -67
package/AGENTS.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
- `npm run prepare` regenerates `parser.mjs` and `valueParser.mjs` from `.jison` grammars.
|
|
13
13
|
- `npm test` runs the full suite through `scripts/run-tests.mjs`.
|
|
14
14
|
- `node repl.mjs` (or `k-repl`) starts the interactive REPL.
|
|
15
|
-
- `./k.mjs
|
|
15
|
+
- `./k.mjs <file.k>` executes a k source/object file on binary pattern+value stream input from stdin or a file; if the argument is not an existing file, it is treated as an inline k expression.
|
|
16
16
|
|
|
17
17
|
## Coding Style & Naming Conventions
|
|
18
18
|
- JavaScript uses ES modules (`.mjs`) with 2-space indentation and semicolons.
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [6.2.3] — 2026-06-03 — Unified k compiler output
|
|
11
|
+
|
|
12
|
+
### Toolchain
|
|
13
|
+
|
|
14
|
+
- Unified `k-compile` so it can emit `.ko`, `.klib`, and `.kvm` output.
|
|
15
|
+
- Removed the separate `k-compile-lib` binary; use `k-compile ... .klib`.
|
|
16
|
+
- Added inline source snippet input to `k-compile`, matching the `k` CLI style.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
10
20
|
## [6.1.0] — 2026-05-20 — CLI aliases and help
|
|
11
21
|
|
|
12
22
|
### Toolchain
|
|
@@ -61,5 +71,6 @@ This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
61
71
|
|
|
62
72
|
---
|
|
63
73
|
|
|
74
|
+
[6.2.3]: https://github.com/fraczak/k/releases/tag/v6.2.3
|
|
64
75
|
[6.1.0]: https://github.com/fraczak/k/releases/tag/v6.1.0
|
|
65
76
|
[6.0.0]: https://github.com/fraczak/k/releases/tag/v6.0.0
|
package/CLAUDE.md
CHANGED
|
@@ -20,7 +20,7 @@ npm test # Run comprehensive test suite (unit tests, derivation tests, shell te
|
|
|
20
20
|
|
|
21
21
|
**Running k programs:**
|
|
22
22
|
```bash
|
|
23
|
-
./k.mjs
|
|
23
|
+
./k.mjs <file.k> # Execute k source/object file
|
|
24
24
|
./repl.mjs # Start interactive REPL (or: k-repl)
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -133,25 +133,28 @@ Loading an object hydrates the type-pattern graphs back into runtime
|
|
|
133
133
|
Object execution through `k.mjs`:
|
|
134
134
|
|
|
135
135
|
```sh
|
|
136
|
-
echo "..." | some-codec --parse | k
|
|
136
|
+
echo "..." | some-codec --parse | k path/to/program.ko | some-codec --print
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
compilation.
|
|
139
|
+
When the first positional argument names an existing file, `k.mjs` loads it as
|
|
140
|
+
either an object file or a source `.k` file. It tries to load the file as an
|
|
141
|
+
object first, then falls back to source parsing and compilation.
|
|
142
142
|
|
|
143
143
|
Standalone helpers live in `objects/`:
|
|
144
144
|
|
|
145
145
|
```sh
|
|
146
146
|
k-compile path/to/program.k path/to/program.ko
|
|
147
|
-
k-compile
|
|
147
|
+
k-compile path/to/library.k path/to/library.klib
|
|
148
|
+
k-compile path/to/program.k path/to/program.kvm
|
|
148
149
|
k-decompile path/to/program.ko path/to/program.decompiled.k
|
|
149
150
|
k-extract-aliases path/to/library.klib path/to/aliases.k
|
|
150
151
|
```
|
|
151
152
|
|
|
152
|
-
With no arguments, the helpers
|
|
153
|
+
`k-compile` also accepts inline source snippets. With no arguments, the helpers
|
|
154
|
+
read from stdin and write to stdout:
|
|
153
155
|
|
|
154
156
|
```sh
|
|
157
|
+
k-compile 'x = |x; x x' > path/to/program.ko
|
|
155
158
|
cat path/to/program.k | k-compile > path/to/program.ko
|
|
156
159
|
cat path/to/program.ko | k-decompile > path/to/program.decompiled.k
|
|
157
160
|
```
|
|
@@ -259,7 +262,7 @@ succ = |succ;
|
|
|
259
262
|
compile it with:
|
|
260
263
|
|
|
261
264
|
```sh
|
|
262
|
-
k-compile
|
|
265
|
+
k-compile defs.k defs.klib
|
|
263
266
|
```
|
|
264
267
|
|
|
265
268
|
The output file is plain JSON and starts with `{`, not a binary prefix. Its
|
package/README.md
CHANGED
|
@@ -151,9 +151,11 @@ k programs can be compiled into:
|
|
|
151
151
|
|
|
152
152
|
- `.klib`: plain JSON library objects
|
|
153
153
|
- `.ko`: executable binary object containers
|
|
154
|
+
- `.kvm`: JSON kVM programs
|
|
154
155
|
|
|
155
|
-
|
|
156
|
-
type-derivation status.
|
|
156
|
+
Object and library files keep canonical code/relation definitions, aliases,
|
|
157
|
+
metadata, and type-derivation status. The `.kvm` output is a lowered JSON
|
|
158
|
+
program for backend inspection and execution experiments.
|
|
157
159
|
|
|
158
160
|
## CLI Tour
|
|
159
161
|
|
|
@@ -161,7 +163,7 @@ type-derivation status.
|
|
|
161
163
|
|
|
162
164
|
| Command | Purpose |
|
|
163
165
|
| --- | --- |
|
|
164
|
-
| `k` | Execute a k expression, or
|
|
166
|
+
| `k` | Execute a k expression, or an existing source/object file, over a binary stream |
|
|
165
167
|
| `k-repl` | Start the interactive interpreter |
|
|
166
168
|
|
|
167
169
|
**Serialization boundaries**
|
|
@@ -186,8 +188,7 @@ type-derivation status.
|
|
|
186
188
|
|
|
187
189
|
| Command | Purpose |
|
|
188
190
|
| --- | --- |
|
|
189
|
-
| `k-compile` | Compile `.k` source to
|
|
190
|
-
| `k-compile-lib` | Compile `.k` source to a `.klib` library |
|
|
191
|
+
| `k-compile` | Compile `.k` source to `.ko`, `.klib`, or `.kvm` output |
|
|
191
192
|
| `k-decompile` | Decompile `.ko` or `.klib` back to k source |
|
|
192
193
|
| `k-extract-aliases` | Recover metadata aliases as k source |
|
|
193
194
|
|