hclang 0.19.0 → 0.20.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/esm/cli/hc.js +8 -2
- package/esm/lib/execute/eval-pipe.js +45 -4
- package/esm/lib/execute/hc-eval.js +4 -7
- package/esm/lib/execute/lex-pipe.js +70 -2
- package/esm/lib/execute/parse-pipe.js +84 -6
- package/esm/lib/execute/resource-import.js +81 -0
- package/esm/lib/execute/terminals.js +4 -1
- package/esm/lib/frames/evaluation-scope.js +70 -1
- package/esm/lib/frames/frame-handle.js +6 -0
- package/esm/lib/frames/frame-import.js +54 -0
- package/esm/lib/frames/frame-symbol.js +7 -14
- package/esm/lib/frames/meta-frame.js +58 -3
- package/esm/lib/frames/resource-store.js +59 -0
- package/esm/lib/frames.js +2 -1
- package/esm/lib/modules/standard-modules.js +42 -0
- package/esm/lib/modules/standard-sources.js +316 -0
- package/esm/lib/version.js +1 -1
- package/package.json +1 -1
package/esm/cli/hc.js
CHANGED
|
@@ -9,6 +9,7 @@ import { parseArgs } from "../deps/jsr.io/@std/cli/1.0.32/parse_args.js";
|
|
|
9
9
|
import { runfile } from "./runfile.js";
|
|
10
10
|
import { Prompt } from "./prompt.js";
|
|
11
11
|
import { DenoFileStore } from "./resource-store.js";
|
|
12
|
+
import { withStandardModules } from "../lib/modules/standard-modules.js";
|
|
12
13
|
import { CLOCK_SCHEME, ClockHandler, Frame, FrameResource, RealClock, RESOURCE_ROOT_KEY, ResourceHandlers, } from "../lib/frames.js";
|
|
13
14
|
/**
|
|
14
15
|
* @module hc
|
|
@@ -46,7 +47,9 @@ export function getOptions(args) {
|
|
|
46
47
|
* identifier resolves against a fresh temp directory rather than against the
|
|
47
48
|
* working directory. That is a narrowing: the process still holds whatever the
|
|
48
49
|
* harness granted it, and the root binding is the ceiling the language enforces
|
|
49
|
-
* inside it.
|
|
50
|
+
* inside it. The root also overlays the read-only standard modules, so
|
|
51
|
+
* `'./modules/figures.hc'` reads the maintained Figures source and nothing else
|
|
52
|
+
* widens.
|
|
50
53
|
*
|
|
51
54
|
* @param env - An object containing key-value pairs of environment variables.
|
|
52
55
|
* @param out - Optional output sink. Tests inject a capture frame; the CLI uses HCLog.
|
|
@@ -60,6 +63,9 @@ export function getEval(env, out) {
|
|
|
60
63
|
/**
|
|
61
64
|
* Builds this harness's host namespace, root binding included.
|
|
62
65
|
*
|
|
66
|
+
* The root is a fresh temp directory with the read-only standard modules laid
|
|
67
|
+
* over it, so a program can import them without reaching anything else.
|
|
68
|
+
*
|
|
63
69
|
* Exported so a test can run a source unit under the authority the CLI actually
|
|
64
70
|
* grants, rather than under an empty namespace that would make the resource
|
|
65
71
|
* primitive invisible.
|
|
@@ -72,7 +78,7 @@ export function getHost(context = {}) {
|
|
|
72
78
|
// logger holds the same one: the root binding belongs to the host namespace
|
|
73
79
|
// and nowhere else.
|
|
74
80
|
const host = new Frame({ ...context });
|
|
75
|
-
host.set(RESOURCE_ROOT_KEY, FrameResource.root(new DenoFileStore(), getHandlers()));
|
|
81
|
+
host.set(RESOURCE_ROOT_KEY, FrameResource.root(withStandardModules(new DenoFileStore()), getHandlers()));
|
|
76
82
|
return host;
|
|
77
83
|
}
|
|
78
84
|
/**
|
|
@@ -1,6 +1,39 @@
|
|
|
1
|
-
import { EvaluationScope, Frame, NilContext } from "../frames.js";
|
|
1
|
+
import { EvaluationScope, Frame, FrameGroup, NilContext, } from "../frames.js";
|
|
2
|
+
import { LexPipe } from "./lex-pipe.js";
|
|
3
|
+
import { ParsePipe } from "./parse-pipe.js";
|
|
4
|
+
/** Builds the shared Lex/Parse/Eval pipeline for one HC source unit. */
|
|
5
|
+
export function makeSourcePipe(evaluator, options = {}) {
|
|
6
|
+
return new LexPipe(new ParsePipe(evaluator, FrameGroup, options));
|
|
7
|
+
}
|
|
8
|
+
/** Live lexical lookup over every layer in one supplied evaluation scope. */
|
|
9
|
+
class ScopedLexicalContext extends Frame {
|
|
10
|
+
constructor(scope) {
|
|
11
|
+
super();
|
|
12
|
+
Object.defineProperty(this, "scope", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: scope
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
get(key) {
|
|
20
|
+
const receiver = this.scope.receiverState?.receiver;
|
|
21
|
+
for (const context of this.scope.lookupFrames()) {
|
|
22
|
+
const value = context.get(key, receiver ?? context);
|
|
23
|
+
if (!value.is.missing)
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
return Frame.missing;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
2
29
|
/** Evaluates parsed groups against one source unit and emits to its output. */
|
|
3
30
|
export class EvalPipe extends Frame {
|
|
31
|
+
static scoped(out, scope) {
|
|
32
|
+
const pipe = new EvalPipe(out, scope.fileScope, scope.hostNamespace);
|
|
33
|
+
pipe.scope = scope;
|
|
34
|
+
pipe.set(Frame.kOUT, new ScopedLexicalContext(scope));
|
|
35
|
+
return pipe;
|
|
36
|
+
}
|
|
4
37
|
constructor(out, fileScope = out, hostNamespace = Frame.nil, meta = NilContext) {
|
|
5
38
|
super(meta);
|
|
6
39
|
Object.defineProperty(this, "out", {
|
|
@@ -21,13 +54,21 @@ export class EvalPipe extends Frame {
|
|
|
21
54
|
writable: true,
|
|
22
55
|
value: hostNamespace
|
|
23
56
|
});
|
|
24
|
-
|
|
25
|
-
|
|
57
|
+
Object.defineProperty(this, "scope", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
configurable: true,
|
|
60
|
+
writable: true,
|
|
61
|
+
value: void 0
|
|
62
|
+
});
|
|
63
|
+
// Legacy lexical features follow kOUT to the file scope. Scoped pipes
|
|
64
|
+
// replace it with a live view of every supplied lookup layer.
|
|
26
65
|
this.set(Frame.kOUT, fileScope);
|
|
27
66
|
this.up = out;
|
|
28
67
|
}
|
|
29
68
|
apply(expr, context) {
|
|
30
|
-
const
|
|
69
|
+
const scope = this.scope ??
|
|
70
|
+
EvaluationScope.root(this.fileScope, this.hostNamespace);
|
|
71
|
+
const result = expr.in(scope);
|
|
31
72
|
this.out.collect(result, context);
|
|
32
73
|
return result;
|
|
33
74
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Frame,
|
|
2
|
-
import { EvalPipe } from "./eval-pipe.js";
|
|
3
|
-
import {
|
|
4
|
-
import { ParsePipe } from "./parse-pipe.js";
|
|
1
|
+
import { Frame, FrameInt, FrameString, FrameSymbol, } from "../frames.js";
|
|
2
|
+
import { EvalPipe, makeSourcePipe } from "./eval-pipe.js";
|
|
3
|
+
import { evaluateResourceSource } from "./resource-import.js";
|
|
5
4
|
import { sigilizer } from "./sigilizer.js";
|
|
6
5
|
/**
|
|
7
6
|
* Creates a new context from the given key-value entries.
|
|
@@ -54,9 +53,7 @@ export class HCEval {
|
|
|
54
53
|
* Creates a lexical pipe for evaluating expressions.
|
|
55
54
|
*/
|
|
56
55
|
static make_pipe(out, fileScope = out, hostNamespace = Frame.nil) {
|
|
57
|
-
|
|
58
|
-
const parser = new ParsePipe(evaluator, FrameGroup);
|
|
59
|
-
return new LexPipe(parser);
|
|
56
|
+
return makeSourcePipe(new EvalPipe(out, fileScope, hostNamespace), { importSource: evaluateResourceSource });
|
|
60
57
|
}
|
|
61
58
|
constructor(out, fileScope = out, hostNamespace = Frame.nil) {
|
|
62
59
|
Object.defineProperty(this, "out", {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Frame, FrameString, FrameSymbol, } from "../frames.js";
|
|
1
|
+
import { Frame, FrameInt, FrameOperator, FrameSchema, FrameString, FrameSymbol, } from "../frames.js";
|
|
2
|
+
import { Token } from "./lex.js";
|
|
3
|
+
import { sigilizer } from "./sigilizer.js";
|
|
2
4
|
import { getSyntax } from "./syntax.js";
|
|
3
5
|
function ensure_factory(factory) {
|
|
4
6
|
if (factory instanceof Frame) {
|
|
@@ -17,6 +19,12 @@ export class LexPipe extends Frame {
|
|
|
17
19
|
writable: true,
|
|
18
20
|
value: void 0
|
|
19
21
|
});
|
|
22
|
+
Object.defineProperty(this, "angleLookahead", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: void 0
|
|
27
|
+
});
|
|
20
28
|
this.level = 0;
|
|
21
29
|
}
|
|
22
30
|
lex_string(input) {
|
|
@@ -26,7 +34,46 @@ export class LexPipe extends Frame {
|
|
|
26
34
|
lex(source) {
|
|
27
35
|
return source.scanInto(this);
|
|
28
36
|
}
|
|
37
|
+
scan(argument) {
|
|
38
|
+
const pending = this.angleLookahead;
|
|
39
|
+
if (pending === undefined)
|
|
40
|
+
return super.scan(argument);
|
|
41
|
+
const symbol = argument.toString();
|
|
42
|
+
if (pending === "<") {
|
|
43
|
+
if (symbol === "-") {
|
|
44
|
+
this.angleLookahead = "<-";
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
this.angleLookahead = undefined;
|
|
48
|
+
const pushed = this.perform({ push: FrameSchema });
|
|
49
|
+
return pushed === this ? super.scan(argument) : pushed;
|
|
50
|
+
}
|
|
51
|
+
this.angleLookahead = undefined;
|
|
52
|
+
if (FrameInt.NUMBER_CHAR.test(symbol)) {
|
|
53
|
+
const pushed = this.perform({ push: FrameSchema });
|
|
54
|
+
if (pushed !== this)
|
|
55
|
+
return pushed;
|
|
56
|
+
const withMinus = sigilizer.scan(this, FrameSymbol.for("-"));
|
|
57
|
+
return sigilizer.scan(withMinus, argument);
|
|
58
|
+
}
|
|
59
|
+
this.emitImportArrow();
|
|
60
|
+
return super.scan(argument);
|
|
61
|
+
}
|
|
29
62
|
finish(_parameter) {
|
|
63
|
+
const pending = this.angleLookahead;
|
|
64
|
+
this.angleLookahead = undefined;
|
|
65
|
+
if (pending === "<") {
|
|
66
|
+
const pushed = this.perform({ push: FrameSchema });
|
|
67
|
+
if (pushed !== this)
|
|
68
|
+
return pushed;
|
|
69
|
+
}
|
|
70
|
+
else if (pending === "<-") {
|
|
71
|
+
this.emitImportArrow();
|
|
72
|
+
}
|
|
73
|
+
const parser = this.get(Frame.kOUT);
|
|
74
|
+
if (parser.strictStructure && this.level !== 0) {
|
|
75
|
+
return this.structureFailure("unclosed", `${this.level}`);
|
|
76
|
+
}
|
|
30
77
|
const next_parser = this.unbind();
|
|
31
78
|
const output = FrameSymbol.end();
|
|
32
79
|
next_parser.call(output);
|
|
@@ -41,6 +88,10 @@ export class LexPipe extends Frame {
|
|
|
41
88
|
}
|
|
42
89
|
perform(action) {
|
|
43
90
|
for (const [key, value] of Object.entries(action)) {
|
|
91
|
+
if (key === "angle") {
|
|
92
|
+
this.angleLookahead = "<";
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
44
95
|
const skip = key === "push";
|
|
45
96
|
let parser = this.unbind(skip);
|
|
46
97
|
switch (key) {
|
|
@@ -53,6 +104,10 @@ export class LexPipe extends Frame {
|
|
|
53
104
|
break;
|
|
54
105
|
}
|
|
55
106
|
case "end": {
|
|
107
|
+
if (this.level !== 0) {
|
|
108
|
+
parser.next(false);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
56
111
|
if (value instanceof Frame) {
|
|
57
112
|
parser.finish(value);
|
|
58
113
|
}
|
|
@@ -74,12 +129,18 @@ export class LexPipe extends Frame {
|
|
|
74
129
|
break;
|
|
75
130
|
}
|
|
76
131
|
case "pop": {
|
|
132
|
+
const factory = ensure_factory(value);
|
|
77
133
|
if (this.level === 0) {
|
|
134
|
+
if (parser.strictStructure) {
|
|
135
|
+
return this.structureFailure("unmatched", factory.name);
|
|
136
|
+
}
|
|
78
137
|
console.error("LexPipe.perform.pop.failed: already at top level");
|
|
79
138
|
break;
|
|
80
139
|
}
|
|
81
|
-
const factory = ensure_factory(value);
|
|
82
140
|
if (!parser.canPop(factory)) {
|
|
141
|
+
if (parser.strictStructure) {
|
|
142
|
+
return this.structureFailure("mismatched", `${factory.name} ${parser.factoryName()}`);
|
|
143
|
+
}
|
|
83
144
|
break;
|
|
84
145
|
}
|
|
85
146
|
parser = parser.pop(factory);
|
|
@@ -91,4 +152,11 @@ export class LexPipe extends Frame {
|
|
|
91
152
|
}
|
|
92
153
|
return this;
|
|
93
154
|
}
|
|
155
|
+
emitImportArrow() {
|
|
156
|
+
const parser = this.get(Frame.kOUT);
|
|
157
|
+
parser.call(new Token(new FrameOperator("<-")));
|
|
158
|
+
}
|
|
159
|
+
structureFailure(kind, detail) {
|
|
160
|
+
return Frame.error(`$!.parse-${kind}-structure ${detail}`);
|
|
161
|
+
}
|
|
94
162
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Frame, FrameArray, FrameBind, FrameExpr, FrameGroup, FrameSchema, } from "../frames.js";
|
|
1
|
+
import { Frame, FrameArray, FrameBind, FrameExpr, FrameGroup, FrameImport, FrameName, FrameOperator, FrameSchema, FrameSymbol, } from "../frames.js";
|
|
2
2
|
import { Terminal } from "./terminals.js";
|
|
3
3
|
export class ParsePipe extends FrameArray {
|
|
4
|
-
constructor(out, factory) {
|
|
4
|
+
constructor(out, factory, options = {}) {
|
|
5
5
|
const meta = {};
|
|
6
6
|
meta[ParsePipe.kOUT] = out;
|
|
7
7
|
meta[Frame.kEND] = Terminal.end();
|
|
@@ -12,6 +12,12 @@ export class ParsePipe extends FrameArray {
|
|
|
12
12
|
writable: true,
|
|
13
13
|
value: void 0
|
|
14
14
|
});
|
|
15
|
+
Object.defineProperty(this, "strictStructure", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: void 0
|
|
20
|
+
});
|
|
15
21
|
Object.defineProperty(this, "Factory", {
|
|
16
22
|
enumerable: true,
|
|
17
23
|
configurable: true,
|
|
@@ -32,9 +38,17 @@ export class ParsePipe extends FrameArray {
|
|
|
32
38
|
writable: true,
|
|
33
39
|
value: false
|
|
34
40
|
});
|
|
41
|
+
Object.defineProperty(this, "options", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true,
|
|
45
|
+
value: void 0
|
|
46
|
+
});
|
|
35
47
|
this.Factory = factory;
|
|
36
48
|
this.collector = [];
|
|
37
49
|
this.nested = out instanceof ParsePipe;
|
|
50
|
+
this.options = options;
|
|
51
|
+
this.strictStructure = options.strictStructure ?? false;
|
|
38
52
|
}
|
|
39
53
|
next(statement = false) {
|
|
40
54
|
if (statement) {
|
|
@@ -52,8 +66,11 @@ export class ParsePipe extends FrameArray {
|
|
|
52
66
|
if (statement) {
|
|
53
67
|
expr.is.statement = true;
|
|
54
68
|
}
|
|
55
|
-
this.collector.push(expr);
|
|
69
|
+
this.collector.push(this.importExpression(expr));
|
|
56
70
|
this.reset();
|
|
71
|
+
if (statement && this.emitsCompletedForms()) {
|
|
72
|
+
this.emitCompletedForm();
|
|
73
|
+
}
|
|
57
74
|
return this;
|
|
58
75
|
}
|
|
59
76
|
bind(_Factory = undefined) {
|
|
@@ -67,8 +84,7 @@ export class ParsePipe extends FrameArray {
|
|
|
67
84
|
return next;
|
|
68
85
|
}
|
|
69
86
|
push(Factory) {
|
|
70
|
-
|
|
71
|
-
return child;
|
|
87
|
+
return new ParsePipe(this, Factory, this.options);
|
|
72
88
|
}
|
|
73
89
|
pop(_Factory) {
|
|
74
90
|
const parent = this.get(ParsePipe.kOUT);
|
|
@@ -77,14 +93,21 @@ export class ParsePipe extends FrameArray {
|
|
|
77
93
|
}
|
|
78
94
|
canPop(Factory) {
|
|
79
95
|
const match = this.Factory.name === Factory.name;
|
|
80
|
-
if (!match) {
|
|
96
|
+
if (!match && !this.strictStructure) {
|
|
81
97
|
console.error(`ParsePipe.canPop.failed: ${Factory.name} cannot pop ${this.Factory.name}`);
|
|
82
98
|
}
|
|
83
99
|
return match;
|
|
84
100
|
}
|
|
101
|
+
factoryName() {
|
|
102
|
+
return this.Factory.name;
|
|
103
|
+
}
|
|
85
104
|
finish(terminal) {
|
|
86
105
|
this.next();
|
|
87
106
|
const out = this.get(Frame.kOUT);
|
|
107
|
+
if (this.emitsCompletedForms() && this.collector.length === 0) {
|
|
108
|
+
out.call(terminal);
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
88
111
|
let value = this.makeFrame();
|
|
89
112
|
if (value instanceof FrameBind && value.isEmpty()) {
|
|
90
113
|
return out;
|
|
@@ -110,4 +133,59 @@ export class ParsePipe extends FrameArray {
|
|
|
110
133
|
this.sequenced = false;
|
|
111
134
|
return group;
|
|
112
135
|
}
|
|
136
|
+
emitsCompletedForms() {
|
|
137
|
+
return !this.nested && (this.options.emitCompletedForms ?? false);
|
|
138
|
+
}
|
|
139
|
+
emitCompletedForm() {
|
|
140
|
+
const out = this.get(Frame.kOUT);
|
|
141
|
+
out.call(this.makeFrame());
|
|
142
|
+
}
|
|
143
|
+
importExpression(expr) {
|
|
144
|
+
if (this.Factory === FrameBind)
|
|
145
|
+
return expr;
|
|
146
|
+
let terms = expr.asArray().map(unwrapImportTerm);
|
|
147
|
+
if (terms.length === 2 &&
|
|
148
|
+
(terms[1] instanceof FrameBind || terms[1] instanceof FrameExpr)) {
|
|
149
|
+
const remainder = terms[1].asArray().map(unwrapImportTerm);
|
|
150
|
+
if (remainder[0] instanceof FrameOperator &&
|
|
151
|
+
remainder[0].operator === "<-") {
|
|
152
|
+
terms = [terms[0], ...remainder];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const arrows = terms.filter((term) => term instanceof FrameOperator && term.operator === "<-");
|
|
156
|
+
if (arrows.length === 0)
|
|
157
|
+
return expr;
|
|
158
|
+
const fail = () => wrapExpression(Frame.error(`$!.resource-import-syntax ${expr.toString()}`), expr);
|
|
159
|
+
if (arrows.length !== 1 || terms.length !== 3 ||
|
|
160
|
+
!(terms[1] instanceof FrameOperator) ||
|
|
161
|
+
terms[1].operator !== "<-" || this.options.importSource === undefined) {
|
|
162
|
+
return fail();
|
|
163
|
+
}
|
|
164
|
+
let target;
|
|
165
|
+
if (terms[0] instanceof FrameName && terms[0].source === "") {
|
|
166
|
+
target = { kind: "local" };
|
|
167
|
+
}
|
|
168
|
+
else if (terms[0] instanceof FrameSymbol &&
|
|
169
|
+
Object.getPrototypeOf(terms[0]) === FrameSymbol.prototype) {
|
|
170
|
+
target = { kind: "named", key: terms[0].spelling() };
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
return fail();
|
|
174
|
+
}
|
|
175
|
+
return wrapExpression(new FrameImport(target, terms[2], this.options.importSource), expr);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function unwrapImportTerm(frame) {
|
|
179
|
+
let result = frame;
|
|
180
|
+
while ((result instanceof FrameBind || result instanceof FrameExpr) &&
|
|
181
|
+
result.size() === 1) {
|
|
182
|
+
result = result.asArray()[0];
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
function wrapExpression(value, source) {
|
|
187
|
+
const result = new FrameExpr([value]);
|
|
188
|
+
if (source.is.statement === true)
|
|
189
|
+
result.is.statement = true;
|
|
190
|
+
return result;
|
|
113
191
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Frame, FrameExpr, FrameSymbol, hasCharacterContent, } from "../frames.js";
|
|
2
|
+
import { EvalPipe, makeSourcePipe } from "./eval-pipe.js";
|
|
3
|
+
import { sigilizer } from "./sigilizer.js";
|
|
4
|
+
/** Private output state for one imported source evaluation. */
|
|
5
|
+
class ImportProgress extends Frame {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
Object.defineProperty(this, "lastResult", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: Frame.nil
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(this, "firstFailure", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: void 0
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
collect(value) {
|
|
22
|
+
const answer = FrameExpr.answeredValue(value);
|
|
23
|
+
if (this.firstFailure === undefined) {
|
|
24
|
+
if (answer.isFailedResult()) {
|
|
25
|
+
this.firstFailure = answer;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this.lastResult = answer;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const sourceTypeFailure = (value) => Frame.error(`$!.resource-import-source-type ${value.toString()}`);
|
|
35
|
+
/** Evaluate a resource's character elements through the existing HC pipeline. */
|
|
36
|
+
export function evaluateResourceSource(resource, scope) {
|
|
37
|
+
return evaluateResourceSourceWithChain(resource, scope, []);
|
|
38
|
+
}
|
|
39
|
+
function evaluateResourceSourceWithChain(resource, scope, activeImports) {
|
|
40
|
+
const spelling = resource.toString();
|
|
41
|
+
if (activeImports.some((active) => active.hostNamespace === scope.hostNamespace &&
|
|
42
|
+
active.resource === spelling)) {
|
|
43
|
+
return Frame.error(`$!.resource-import-cycle ${spelling}`);
|
|
44
|
+
}
|
|
45
|
+
const nextActiveImports = [
|
|
46
|
+
...activeImports,
|
|
47
|
+
{ hostNamespace: scope.hostNamespace, resource: spelling },
|
|
48
|
+
];
|
|
49
|
+
const progress = new ImportProgress();
|
|
50
|
+
const lexer = makeSourcePipe(EvalPipe.scoped(progress, scope), {
|
|
51
|
+
importSource: (nestedResource, nestedScope) => evaluateResourceSourceWithChain(nestedResource, nestedScope, nextActiveImports),
|
|
52
|
+
emitCompletedForms: true,
|
|
53
|
+
strictStructure: true,
|
|
54
|
+
});
|
|
55
|
+
let receiver = lexer;
|
|
56
|
+
const elements = resource.elements();
|
|
57
|
+
for (const element of elements) {
|
|
58
|
+
if (element.isFailedResult())
|
|
59
|
+
return element;
|
|
60
|
+
if (!hasCharacterContent(element))
|
|
61
|
+
return sourceTypeFailure(element);
|
|
62
|
+
for (const character of element.characterContent().split("")) {
|
|
63
|
+
receiver = sigilizer.scan(receiver, FrameSymbol.for(character));
|
|
64
|
+
if (receiver.isFailedResult())
|
|
65
|
+
return receiver;
|
|
66
|
+
if (progress.firstFailure)
|
|
67
|
+
return progress.firstFailure;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (receiver !== lexer) {
|
|
71
|
+
receiver = sigilizer.finish(receiver, FrameSymbol.end());
|
|
72
|
+
if (receiver.isFailedResult())
|
|
73
|
+
return receiver;
|
|
74
|
+
if (progress.firstFailure)
|
|
75
|
+
return progress.firstFailure;
|
|
76
|
+
}
|
|
77
|
+
const finished = lexer.finish(Frame.nil);
|
|
78
|
+
if (finished.isFailedResult())
|
|
79
|
+
return finished;
|
|
80
|
+
return progress.firstFailure ?? progress.lastResult;
|
|
81
|
+
}
|
|
@@ -48,7 +48,10 @@ function addGroup(Grouper) {
|
|
|
48
48
|
if (mode !== "push" && mode !== "pop") {
|
|
49
49
|
throw new Error(`Invalid structural Sigil mode: ${mode}`);
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
const action = Grouper === FrameSchema && key === FrameSchema.BEGIN_SCHEMA
|
|
52
|
+
? "angle"
|
|
53
|
+
: mode;
|
|
54
|
+
terminals[key] = new Terminal(perform({ [action]: Grouper }));
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
terminals[Frame.kEND] = Terminal.end();
|
|
@@ -9,9 +9,56 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _EvaluationScope_lookupFrames, _EvaluationScope_lookupMembers;
|
|
12
|
+
var _LiveLookupContext_lookupFrames, _LiveLookupContext_identityHandles, _EvaluationScope_lookupFrames, _EvaluationScope_lookupMembers;
|
|
13
13
|
import { Frame } from "./frame.js";
|
|
14
14
|
import { FrameHandle } from "./frame-handle.js";
|
|
15
|
+
/** Live, read-only lookup through an ordered set of existing frame identities. */
|
|
16
|
+
class LiveLookupContext extends Frame {
|
|
17
|
+
constructor(frames, continuation) {
|
|
18
|
+
super();
|
|
19
|
+
Object.defineProperty(this, "continuation", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
configurable: true,
|
|
22
|
+
writable: true,
|
|
23
|
+
value: continuation
|
|
24
|
+
});
|
|
25
|
+
_LiveLookupContext_lookupFrames.set(this, void 0);
|
|
26
|
+
_LiveLookupContext_identityHandles.set(this, new WeakMap());
|
|
27
|
+
__classPrivateFieldSet(this, _LiveLookupContext_lookupFrames, frames.map((frame) => frame instanceof FrameHandle ? frame.withoutWriteAuthority() : frame), "f");
|
|
28
|
+
}
|
|
29
|
+
resolve_here(key, _origin = this) {
|
|
30
|
+
for (const context of __classPrivateFieldGet(this, _LiveLookupContext_lookupFrames, "f")) {
|
|
31
|
+
// The same non-global graph as `lookup_here`, so a value and its binding
|
|
32
|
+
// agree; the outer resolve keeps the single global tier.
|
|
33
|
+
const binding = this.resolve_graph_on(context, key, context);
|
|
34
|
+
if (binding)
|
|
35
|
+
return binding;
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
lookup_here(key, _origin) {
|
|
40
|
+
for (const context of __classPrivateFieldGet(this, _LiveLookupContext_lookupFrames, "f")) {
|
|
41
|
+
// Non-global graph only: an operator falls through to the outer lookup's
|
|
42
|
+
// global tier, which curries it with that lookup's own operand.
|
|
43
|
+
const value = this.lookup_graph_on(context, key, context);
|
|
44
|
+
if (value.is.missing)
|
|
45
|
+
continue;
|
|
46
|
+
if (value instanceof FrameHandle) {
|
|
47
|
+
return value.withoutWriteAuthority();
|
|
48
|
+
}
|
|
49
|
+
if (!value.ownsIdentity())
|
|
50
|
+
return value;
|
|
51
|
+
const existing = __classPrivateFieldGet(this, _LiveLookupContext_identityHandles, "f").get(value);
|
|
52
|
+
if (existing)
|
|
53
|
+
return existing;
|
|
54
|
+
const projected = new FrameHandle(value, false, undefined, this.continuation);
|
|
55
|
+
__classPrivateFieldGet(this, _LiveLookupContext_identityHandles, "f").set(value, projected);
|
|
56
|
+
return projected;
|
|
57
|
+
}
|
|
58
|
+
return Frame.missing;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
_LiveLookupContext_lookupFrames = new WeakMap(), _LiveLookupContext_identityHandles = new WeakMap();
|
|
15
62
|
/**
|
|
16
63
|
* Named, immutable state for one evaluation.
|
|
17
64
|
*
|
|
@@ -214,6 +261,28 @@ export class EvaluationScope {
|
|
|
214
261
|
carriedRoots?.hostNamespace ?? Frame.nil,
|
|
215
262
|
});
|
|
216
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Creates a fresh named namespace with live lookup into this scope.
|
|
266
|
+
*
|
|
267
|
+
* Imported declarations stop at the namespace, while lookup retains exact
|
|
268
|
+
* references to the caller's existing layers. Call-only parameter and
|
|
269
|
+
* receiver authority are deliberately not inherited.
|
|
270
|
+
*/
|
|
271
|
+
namedChild(namespace) {
|
|
272
|
+
namespace.up = new LiveLookupContext(__classPrivateFieldGet(this, _EvaluationScope_lookupFrames, "f"), namespace);
|
|
273
|
+
const layers = EvaluationScope.layers([namespace]);
|
|
274
|
+
return new EvaluationScope({
|
|
275
|
+
argument: namespace,
|
|
276
|
+
writeTarget: namespace,
|
|
277
|
+
writeTargetRole: "statement",
|
|
278
|
+
lookupFrames: layers.frames,
|
|
279
|
+
lookupMembers: layers.members,
|
|
280
|
+
enclosing: this,
|
|
281
|
+
lexicalTarget: namespace,
|
|
282
|
+
fileScope: namespace,
|
|
283
|
+
hostNamespace: this.hostNamespace,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
217
286
|
/**
|
|
218
287
|
* Adds syntax or metadata to lookup without changing any named role.
|
|
219
288
|
*
|
|
@@ -75,6 +75,12 @@ export class FrameHandle extends Frame {
|
|
|
75
75
|
isMutable() {
|
|
76
76
|
return this.mutable;
|
|
77
77
|
}
|
|
78
|
+
/** Retains this live reference while withholding its write capability. */
|
|
79
|
+
withoutWriteAuthority() {
|
|
80
|
+
return this.mutable
|
|
81
|
+
? new FrameHandle(this.target, false, this.copyOnWrite, this.readContext, this.searchReadContext)
|
|
82
|
+
: this;
|
|
83
|
+
}
|
|
78
84
|
/** The lexical fallback selected for this particular read. */
|
|
79
85
|
readContextFrame() {
|
|
80
86
|
return this.readContext;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Frame } from "./frame.js";
|
|
2
|
+
import { FrameArray } from "./frame-array.js";
|
|
3
|
+
import { FrameResource } from "./frame-resource.js";
|
|
4
|
+
import { FrameSymbol } from "./frame-symbol.js";
|
|
5
|
+
import { EvaluationScope } from "./evaluation-scope.js";
|
|
6
|
+
/** An import expression whose source evaluator is supplied by the pipeline. */
|
|
7
|
+
export class FrameImport extends Frame {
|
|
8
|
+
constructor(target, resourceExpression, evaluateSource) {
|
|
9
|
+
super();
|
|
10
|
+
Object.defineProperty(this, "target", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: target
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(this, "resourceExpression", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: resourceExpression
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(this, "evaluateSource", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: evaluateSource
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
in(input = []) {
|
|
30
|
+
const scope = EvaluationScope.from(input);
|
|
31
|
+
const resource = this.resourceExpression.in(scope);
|
|
32
|
+
if (resource.isFailedResult())
|
|
33
|
+
return resource;
|
|
34
|
+
if (!(resource instanceof FrameResource)) {
|
|
35
|
+
return Frame.error(`$!.resource-import-source-type ${resource.toString()}`);
|
|
36
|
+
}
|
|
37
|
+
if (this.target.kind === "local") {
|
|
38
|
+
return this.evaluateSource(resource, scope);
|
|
39
|
+
}
|
|
40
|
+
const namespace = new FrameArray([]);
|
|
41
|
+
const child = scope.namedChild(namespace);
|
|
42
|
+
const result = this.evaluateSource(resource, child);
|
|
43
|
+
if (result.isFailedResult())
|
|
44
|
+
return result;
|
|
45
|
+
const binding = FrameSymbol.for(this.target.key)
|
|
46
|
+
.setter(scope.writeTarget)
|
|
47
|
+
.apply(namespace, Frame.nil);
|
|
48
|
+
return binding.isFailedResult() ? binding : result;
|
|
49
|
+
}
|
|
50
|
+
toString() {
|
|
51
|
+
const target = this.target.kind === "local" ? "." : this.target.key;
|
|
52
|
+
return `${target} <- ${this.resourceExpression.toString()}`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -160,20 +160,13 @@ export class FrameSymbol extends FrameAtom {
|
|
|
160
160
|
const scope = EvaluationScope.from(input);
|
|
161
161
|
const first = scope.argument;
|
|
162
162
|
for (const context of scope.lookupFrames()) {
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (binding.value.is.error)
|
|
171
|
-
return binding.value;
|
|
172
|
-
const schema = owner.meta[`${binding.key}.<>`];
|
|
173
|
-
return schema ?? Frame.error(`$!.schema-missing .${this.data}`);
|
|
174
|
-
}
|
|
175
|
-
owner = owner.up;
|
|
176
|
-
}
|
|
163
|
+
const binding = context.resolve(this.data, context);
|
|
164
|
+
if (!binding)
|
|
165
|
+
continue;
|
|
166
|
+
if (binding.value.is.error)
|
|
167
|
+
return binding.value;
|
|
168
|
+
const schema = binding.owner.meta[`${binding.key}.<>`];
|
|
169
|
+
return schema ?? Frame.error(`$!.schema-missing .${this.data}`);
|
|
177
170
|
}
|
|
178
171
|
return FrameNote.key(first.id + "." + this.data, first);
|
|
179
172
|
}
|
|
@@ -108,6 +108,27 @@ export class MetaFrame {
|
|
|
108
108
|
lookup_here_on(frame, key, origin) {
|
|
109
109
|
return frame.lookup_here(key, origin);
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Lets a forwarding link search another frame's non-global lookup graph.
|
|
113
|
+
*
|
|
114
|
+
* `Frame.globals` stays the one final tier of the outer `get`, which
|
|
115
|
+
* curries an operator with that lookup's own origin; a forwarded `get`
|
|
116
|
+
* would reach the globals early, from the wrong frame.
|
|
117
|
+
*/
|
|
118
|
+
lookup_graph_on(frame, key, origin) {
|
|
119
|
+
return MetaFrame.lookup(frame, key, origin, new Set());
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Lets a forwarding link resolve a binding through another frame's
|
|
123
|
+
* non-global graph.
|
|
124
|
+
*
|
|
125
|
+
* The binding counterpart of `lookup_graph_on`, with the same tiers, so a
|
|
126
|
+
* forwarded value and its binding metadata come from the same declaration
|
|
127
|
+
* owner. `Frame.globals` stays the one final tier of the outer `resolve`.
|
|
128
|
+
*/
|
|
129
|
+
resolve_graph_on(frame, key, origin) {
|
|
130
|
+
return MetaFrame.resolveBinding(frame, key, origin, new Set());
|
|
131
|
+
}
|
|
111
132
|
/** Resolves a logical name to the declaration key visible from origin. */
|
|
112
133
|
resolve_here(key, origin = this) {
|
|
113
134
|
if (key.startsWith("__")) {
|
|
@@ -117,11 +138,29 @@ export class MetaFrame {
|
|
|
117
138
|
return this.authorize(key, Visibility.Protected, key.slice(1), origin);
|
|
118
139
|
}
|
|
119
140
|
const publicValue = this.meta[key];
|
|
120
|
-
if (publicValue != null)
|
|
121
|
-
return { key, value: publicValue };
|
|
141
|
+
if (publicValue != null) {
|
|
142
|
+
return { owner: this, key, value: publicValue };
|
|
143
|
+
}
|
|
122
144
|
return this.authorize(`_${key}`, Visibility.Protected, key, origin) ??
|
|
123
145
|
this.authorize(`__${key}`, Visibility.Private, key, origin);
|
|
124
146
|
}
|
|
147
|
+
/** Resolves a binding through the same guarded graph as ordinary lookup. */
|
|
148
|
+
resolve(key, origin = this) {
|
|
149
|
+
const local = this.resolve_here(key, origin);
|
|
150
|
+
if (local)
|
|
151
|
+
return local;
|
|
152
|
+
const seen = new Set([this]);
|
|
153
|
+
for (const link of this.lookup_links()) {
|
|
154
|
+
const result = MetaFrame.resolveBinding(link, key, origin, seen);
|
|
155
|
+
if (result)
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
const globals = Frame.globals;
|
|
159
|
+
if (globals && !globals.is.missing && !seen.has(globals)) {
|
|
160
|
+
return MetaFrame.resolveBinding(globals, key, origin, seen);
|
|
161
|
+
}
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
125
164
|
/**
|
|
126
165
|
* Get a frame by key through one guarded lookup traversal.
|
|
127
166
|
*
|
|
@@ -190,6 +229,21 @@ export class MetaFrame {
|
|
|
190
229
|
}
|
|
191
230
|
return Frame.missing;
|
|
192
231
|
}
|
|
232
|
+
/** Depth-first binding traversal without global fallback. */
|
|
233
|
+
static resolveBinding(frame, key, origin, seen) {
|
|
234
|
+
if (seen.has(frame))
|
|
235
|
+
return undefined;
|
|
236
|
+
seen.add(frame);
|
|
237
|
+
const local = frame.resolve_here(key, origin);
|
|
238
|
+
if (local)
|
|
239
|
+
return local;
|
|
240
|
+
for (const link of frame.lookup_links()) {
|
|
241
|
+
const result = MetaFrame.resolveBinding(link, key, origin, seen);
|
|
242
|
+
if (result)
|
|
243
|
+
return result;
|
|
244
|
+
}
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
193
247
|
/**
|
|
194
248
|
* set adds a new key-value pair to the current context.
|
|
195
249
|
*/
|
|
@@ -295,9 +349,10 @@ export class MetaFrame {
|
|
|
295
349
|
? origin === this
|
|
296
350
|
: this.isAncestorOf(origin));
|
|
297
351
|
if (authorized) {
|
|
298
|
-
return { key: physicalKey, value };
|
|
352
|
+
return { owner: this, key: physicalKey, value };
|
|
299
353
|
}
|
|
300
354
|
return {
|
|
355
|
+
owner: this,
|
|
301
356
|
key: physicalKey,
|
|
302
357
|
value: Frame.error(`$!.is-${visibility} .${key}`),
|
|
303
358
|
};
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _ResourceMapStore_entries;
|
|
1
13
|
/**
|
|
2
14
|
* The host seam a root binding holds.
|
|
3
15
|
*
|
|
@@ -13,6 +25,7 @@
|
|
|
13
25
|
*
|
|
14
26
|
* @module
|
|
15
27
|
*/
|
|
28
|
+
import { normalizeReferencePath } from "./resource-reference.js";
|
|
16
29
|
/**
|
|
17
30
|
* A store with no host behind it at all.
|
|
18
31
|
*
|
|
@@ -50,3 +63,49 @@ export class MemoryStore {
|
|
|
50
63
|
return { ok: true, content };
|
|
51
64
|
}
|
|
52
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* A read-only overlay of fixed entries, keyed by canonical root-relative path,
|
|
68
|
+
* on another store.
|
|
69
|
+
*
|
|
70
|
+
* A harness uses it to serve package-owned HC source without widening its root:
|
|
71
|
+
* exact keys read their entry and refuse writes, and every other path, plus
|
|
72
|
+
* `describe`, is the underlying store's. Keys are checked once, here, so only a
|
|
73
|
+
* path the root plane itself would produce can be installed; a key that fails is
|
|
74
|
+
* a harness defect, and the constructor throws rather than refusing. The entries
|
|
75
|
+
* are copied, so the caller's map cannot change what the overlay serves.
|
|
76
|
+
*/
|
|
77
|
+
export class ResourceMapStore {
|
|
78
|
+
constructor(underlying, entries) {
|
|
79
|
+
Object.defineProperty(this, "underlying", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
configurable: true,
|
|
82
|
+
writable: true,
|
|
83
|
+
value: underlying
|
|
84
|
+
});
|
|
85
|
+
_ResourceMapStore_entries.set(this, void 0);
|
|
86
|
+
const copied = new Map();
|
|
87
|
+
for (const [key, content] of entries) {
|
|
88
|
+
const normal = normalizeReferencePath(key);
|
|
89
|
+
if (key === "" || !normal.ok || normal.path !== key) {
|
|
90
|
+
throw new TypeError(`ResourceMapStore key must be a canonical nonempty path: ${JSON.stringify(key)}`);
|
|
91
|
+
}
|
|
92
|
+
copied.set(key, content);
|
|
93
|
+
}
|
|
94
|
+
__classPrivateFieldSet(this, _ResourceMapStore_entries, copied, "f");
|
|
95
|
+
}
|
|
96
|
+
describe() {
|
|
97
|
+
return this.underlying.describe();
|
|
98
|
+
}
|
|
99
|
+
read(path) {
|
|
100
|
+
const content = __classPrivateFieldGet(this, _ResourceMapStore_entries, "f").get(path);
|
|
101
|
+
return content === undefined
|
|
102
|
+
? this.underlying.read(path)
|
|
103
|
+
: { ok: true, content };
|
|
104
|
+
}
|
|
105
|
+
write(path, content) {
|
|
106
|
+
return __classPrivateFieldGet(this, _ResourceMapStore_entries, "f").has(path)
|
|
107
|
+
? { ok: false, reason: "resource-read-only" }
|
|
108
|
+
: this.underlying.write(path, content);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
_ResourceMapStore_entries = new WeakMap();
|
package/esm/lib/frames.js
CHANGED
|
@@ -15,6 +15,7 @@ export { FrameBind, FrameExpr } from "./frames/frame-expr.js";
|
|
|
15
15
|
// tests, while `WriteTargetRole` stays private to the scope module.
|
|
16
16
|
export { EvaluationScope, } from "./frames/evaluation-scope.js";
|
|
17
17
|
export { FrameGroup } from "./frames/frame-group.js";
|
|
18
|
+
export { FrameImport, } from "./frames/frame-import.js";
|
|
18
19
|
export { FrameLazy } from "./frames/frame-lazy.js";
|
|
19
20
|
export { isFrameMatcher, } from "./frames/frame-match.js";
|
|
20
21
|
export { FrameList } from "./frames/frame-list.js";
|
|
@@ -40,7 +41,7 @@ export { FrameResource } from "./frames/frame-resource.js";
|
|
|
40
41
|
export { isResourceBinding, RESOURCE_ROOT_KEY, } from "./frames/resource-binding.js";
|
|
41
42
|
export { containsResolved, decomposeReference, joinNormalized, normalizeReference, normalizeReferencePath, URI_PART_KEYS, } from "./frames/resource-reference.js";
|
|
42
43
|
export { characterElements, ResourceHandlers, StoreHandler, } from "./frames/resource-handlers.js";
|
|
43
|
-
export { MemoryStore, } from "./frames/resource-store.js";
|
|
44
|
+
export { MemoryStore, ResourceMapStore, } from "./frames/resource-store.js";
|
|
44
45
|
export { Frame, } from "./frames/frame.js";
|
|
45
46
|
export { MetaFrame, Visibility } from "./frames/meta-frame.js";
|
|
46
47
|
export { ScanDisposition, } from "./scan.js";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The standard modules every supported host serves, read-only, under canonical
|
|
3
|
+
* keys.
|
|
4
|
+
*
|
|
5
|
+
* A standard module is HC source the package maintains: every
|
|
6
|
+
* `lib/modules/*.hc` is one, under the key `modules/<file>`, so
|
|
7
|
+
* `lib/modules/figures.hc` is reached from a program as
|
|
8
|
+
* `'./modules/figures.hc'`. The key is root-relative like every other path, so
|
|
9
|
+
* it names a location inside the root binding, never one beside a source file
|
|
10
|
+
* or the working directory. A host lays the modules over its root's store as
|
|
11
|
+
* fixed entries: reading one answers the maintained source, writing one is
|
|
12
|
+
* refused, and every other path, a sibling under `modules/` included, still
|
|
13
|
+
* resolves inside that root. No permission flag and no root widens, so a program
|
|
14
|
+
* gains these reads and nothing else.
|
|
15
|
+
*
|
|
16
|
+
* The sources are compiled into the program from the generated
|
|
17
|
+
* `lib/modules/standard-sources.ts` (`deno task modules:embed`), so the CLI, the
|
|
18
|
+
* compiled binary, the npm package, `HCLang`, and the browser playground serve
|
|
19
|
+
* the same text without reading a file at run time.
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
import { ResourceMapStore, } from "../frames/resource-store.js";
|
|
24
|
+
import { STANDARD_SOURCES } from "./standard-sources.js";
|
|
25
|
+
const MODULES = STANDARD_SOURCES;
|
|
26
|
+
/**
|
|
27
|
+
* The standard modules by canonical key.
|
|
28
|
+
*
|
|
29
|
+
* @returns Each module's source under its key.
|
|
30
|
+
*/
|
|
31
|
+
export function standardModules() {
|
|
32
|
+
return MODULES;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Lays the standard modules over a store as read-only entries.
|
|
36
|
+
*
|
|
37
|
+
* @param store The root's store, which keeps every other path.
|
|
38
|
+
* @returns A store that serves the standard modules and delegates the rest.
|
|
39
|
+
*/
|
|
40
|
+
export function withStandardModules(store) {
|
|
41
|
+
return new ResourceMapStore(store, MODULES);
|
|
42
|
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
// Generated by scripts/embed-modules.ts from lib/modules/*.hc. Do not edit.
|
|
2
|
+
// Regenerate with `deno task modules:embed`.
|
|
3
|
+
/**
|
|
4
|
+
* The maintained source of every `lib/modules/*.hc`, by canonical key, each
|
|
5
|
+
* joined from its lines.
|
|
6
|
+
*/
|
|
7
|
+
export const STANDARD_SOURCES = new Map([
|
|
8
|
+
[
|
|
9
|
+
"modules/figures.hc",
|
|
10
|
+
[
|
|
11
|
+
"#!/usr/bin/env hc",
|
|
12
|
+
"```",
|
|
13
|
+
"Figures (#382)",
|
|
14
|
+
"",
|
|
15
|
+
'Ported from History 005.30c, "The Figure class as idiomatic HC", in',
|
|
16
|
+
"`quilt+s3://protology#package=occurrence/history`. Relational Construction Theory",
|
|
17
|
+
"has one generative operation: construct a Figure with optional, already",
|
|
18
|
+
"constructed children. In HC that operation is the array literal, so nothing is",
|
|
19
|
+
"added to get it. Every observer below answers a Figure, never a number or a",
|
|
20
|
+
"Boolean: `A` means no and `B` means yes.",
|
|
21
|
+
"",
|
|
22
|
+
"30c was written against v0.16.0 and had to work around three behaviours that",
|
|
23
|
+
"v0.17.0 changes. Its observers needed a boxed if/else, they could not use local",
|
|
24
|
+
"names without writing onto the Figure observed, and identity-sameness was",
|
|
25
|
+
"unanswerable. Here each one is written plainly.",
|
|
26
|
+
"",
|
|
27
|
+
"The constructor is the bracket",
|
|
28
|
+
"```",
|
|
29
|
+
"; .A []; .B [A]; .C [B]; .D [C];",
|
|
30
|
+
"; .E [A, B]; .F [B, C]; .G [E, F];",
|
|
31
|
+
"; G",
|
|
32
|
+
"# [[[], [[]]], [[[]], [[[]]]]]",
|
|
33
|
+
"```",
|
|
34
|
+
"A named closure is the one-child form, so a Figure can receive a reduce. For n",
|
|
35
|
+
"children, write the bracket: a group passed to a closure stays one argument",
|
|
36
|
+
"```",
|
|
37
|
+
"; .Figure {[_]};",
|
|
38
|
+
"; Figure (B)",
|
|
39
|
+
"# [[[]]]",
|
|
40
|
+
"; Figure (B, A)",
|
|
41
|
+
"# [([[]], [])]",
|
|
42
|
+
"; [B, A]",
|
|
43
|
+
"# [[[]], []]",
|
|
44
|
+
"```",
|
|
45
|
+
"Manyness is a tally of the immediate children: one mark `B` for each child, so",
|
|
46
|
+
"a count is a row of marks rather than a nest of successors. It maps the children",
|
|
47
|
+
"and looks no deeper, so it needs no recursion and no way to take the rest of a",
|
|
48
|
+
"Figure",
|
|
49
|
+
"```",
|
|
50
|
+
"; .many {_ & {B}};",
|
|
51
|
+
"; many A",
|
|
52
|
+
"# []",
|
|
53
|
+
"; many B",
|
|
54
|
+
"# [[[]]]",
|
|
55
|
+
"; many E",
|
|
56
|
+
"# [[[]], [[]]]",
|
|
57
|
+
"; (many G) = (many E)",
|
|
58
|
+
"# <>",
|
|
59
|
+
"; (many E) = (many B)",
|
|
60
|
+
"# ()",
|
|
61
|
+
"```",
|
|
62
|
+
"Size is recursive cell volume, not immediate Manyness. `Z` reuses `A` as the",
|
|
63
|
+
"additive zero and `U` reuses `B` as the unit cell, the same mark Manyness uses.",
|
|
64
|
+
"Size answers a tally, one `U` for every unit cell, so a count is itself a Figure",
|
|
65
|
+
"of units, and the two observers agree on a flat row of units and part on",
|
|
66
|
+
"nesting. `cat` adds two tallies by reducing one into the other, which collects",
|
|
67
|
+
"into a fresh row and writes neither. `Tally` is a receiver that declares its own",
|
|
68
|
+
"application: each row applied to it is added to the row it holds. Size maps",
|
|
69
|
+
"every immediate child to its Size and reduces those into `Tally`. With no",
|
|
70
|
+
"children there is nothing to reduce, so the reduce answers `Tally` itself, whose",
|
|
71
|
+
"row is empty. The `U` case comes first because its child is `Z`. It tests form",
|
|
72
|
+
"with `=`, so any Figure shaped like `U` is a unit cell and equal-looking Figures",
|
|
73
|
+
"always have equal Size. HC supplies recursive control, child traversal, and",
|
|
74
|
+
"structural `=`; Size needs no identity, and every mathematical value below is",
|
|
75
|
+
"made only with the bracket Figure constructor",
|
|
76
|
+
"```",
|
|
77
|
+
"; .Z A; .U B;",
|
|
78
|
+
"; .cat {(_ .1) | (_ .0)};",
|
|
79
|
+
"; .Tally [.row Z; .apply_ {@row (cat [row, _]);}];",
|
|
80
|
+
"; .size {(_ = U) ? {[U]} : {((__ & {size _}) | Tally) .row}};",
|
|
81
|
+
"; size Z",
|
|
82
|
+
"# []",
|
|
83
|
+
"; size U",
|
|
84
|
+
"# [[[]]]",
|
|
85
|
+
"; (size [U]) = (size [[A]])",
|
|
86
|
+
"# <>",
|
|
87
|
+
"; .row4 [U, U, U, U];",
|
|
88
|
+
"; (size row4) = row4",
|
|
89
|
+
"# <>",
|
|
90
|
+
"; .deep4 [[[row4]]];",
|
|
91
|
+
"; (size deep4) = row4",
|
|
92
|
+
"# <>",
|
|
93
|
+
"; [(many row4) = (size row4), (many deep4) = (size deep4)]",
|
|
94
|
+
"# [<>, ()]",
|
|
95
|
+
"; .two_fours [row4, row4];",
|
|
96
|
+
"; size two_fours",
|
|
97
|
+
"# [[[]], [[]], [[]], [[]], [[]], [[]], [[]], [[]]]",
|
|
98
|
+
"; [(size two_fours) = (cat [row4, row4]), row4 = [U, U, U, U], many two_fours]",
|
|
99
|
+
"# [<>, <>, [[[]], [[]]]]",
|
|
100
|
+
"; Tally .row",
|
|
101
|
+
"# []",
|
|
102
|
+
"```",
|
|
103
|
+
"A tally is its own Size, so Size is idempotent: every count it answers",
|
|
104
|
+
"represents the class it names",
|
|
105
|
+
"```",
|
|
106
|
+
"; (size (size two_fours)) = (size two_fours)",
|
|
107
|
+
"# <>",
|
|
108
|
+
"```",
|
|
109
|
+
"The semiring carrier is not raw Figures under structural or identity equality.",
|
|
110
|
+
"Let `F` be the finite, well-founded Figures made with the bracket, with the",
|
|
111
|
+
"form of `U` as the unit cell, and write `x ≈ y` when `(size x) = (size y)`.",
|
|
112
|
+
"The carrier is the quotient `F/≈`; HC's structural `=` compares the tallies",
|
|
113
|
+
"Size answers. Because Size reads only form, `x = y` implies `x ≈ y`. Its zero",
|
|
114
|
+
"and one are `Z` and `U`. Addition constructs `Figure(x, y)`. Multiplication maps",
|
|
115
|
+
"every cell of `size x` to `y`, so a product reuses `y` once for every cell of",
|
|
116
|
+
"`x` while every result remains a Figure. A product by `Z` is `Z`, because one",
|
|
117
|
+
"row of nothing would be `[Z]`, which has the form of `U` and would count as a",
|
|
118
|
+
"cell. On tallies, `size_mul` is the same map followed by Size",
|
|
119
|
+
"```",
|
|
120
|
+
"; .figure_add {[(_ .0), (_ .1)]};",
|
|
121
|
+
"; .figure_mul {.y (_ .1); (y = Z) ? {Z} : {(size (__ .0)) & {y}}};",
|
|
122
|
+
"; .size_mul {size ((_ .0) & {__ .1})};",
|
|
123
|
+
"; .size_equivalent {((size (_ .0)) = (size (_ .1))) ? {U} : {Z}};",
|
|
124
|
+
"; [figure_mul [U, Z], size [Z]]",
|
|
125
|
+
"# [[], [[[]]]]",
|
|
126
|
+
"```",
|
|
127
|
+
"A non-square product is two occurrences of one three-cell row, and both",
|
|
128
|
+
"positions reuse the same `row3`. Manyness sees two rows, while Size counts six",
|
|
129
|
+
"unit cells",
|
|
130
|
+
"```",
|
|
131
|
+
"; .row2 [U, U]; .row3 [U, U, U];",
|
|
132
|
+
"; .rectangle23 (figure_mul [row2, row3]);",
|
|
133
|
+
"; rectangle23 = [row3, row3]",
|
|
134
|
+
"# <>",
|
|
135
|
+
"; [(rectangle23 .0) === row3, (rectangle23 .1) === row3]",
|
|
136
|
+
"# [<>, <>]",
|
|
137
|
+
"; size rectangle23",
|
|
138
|
+
"# [[[]], [[]], [[]], [[]], [[]], [[]]]",
|
|
139
|
+
"```",
|
|
140
|
+
"The defining equations are executable: Size takes Figure addition to `cat`,",
|
|
141
|
+
"and Figure multiplication to `size_mul`. Therefore both recipes respect `≈`;",
|
|
142
|
+
"the representative checks also use differently nested, equal-Size inputs",
|
|
143
|
+
"```",
|
|
144
|
+
"; [(size (figure_add [row2, row3])) = (cat [size row2, size row3]), (size rectangle23) = (size_mul [size row2, size row3])]",
|
|
145
|
+
"# [<>, <>]",
|
|
146
|
+
"; .deep2 [[row2]]; .deep3 [[[row3]]];",
|
|
147
|
+
"; [size_equivalent [row2, deep2], size_equivalent [row3, deep3], size_equivalent [figure_add [row2, row3], figure_add [deep2, deep3]], size_equivalent [figure_mul [row2, row3], figure_mul [deep2, deep3]]]",
|
|
148
|
+
"# [[[]], [[]], [[]], [[]]]",
|
|
149
|
+
"```",
|
|
150
|
+
"Tallies are the natural numbers in unary, one row of `n` units for each count",
|
|
151
|
+
"`n`, with `cat` as addition and `size_mul` as multiplication. Induction gives",
|
|
152
|
+
"additive identity, associativity and commutativity; multiplicative identity,",
|
|
153
|
+
"associativity and commutativity; both distributive laws; and both zero",
|
|
154
|
+
"annihilations. Transport along Size proves those laws on `F/≈`. The raw product",
|
|
155
|
+
"is not commutative: it maps over the Size of its left operand and reuses its",
|
|
156
|
+
"right operand whole, so `row2` by `row3` is two rows of three, `row3` by `row2`",
|
|
157
|
+
"is three rows of two, and they agree only in Size. These executed instances",
|
|
158
|
+
"witness every law without replacing the inductive proof",
|
|
159
|
+
"```",
|
|
160
|
+
"; [(figure_mul [row2, row3]) = (figure_mul [row3, row2]), size_equivalent [figure_mul [row2, row3], figure_mul [row3, row2]]]",
|
|
161
|
+
"# [(), [[]]]",
|
|
162
|
+
"; [size_equivalent [figure_add [Z, row2], row2], size_equivalent [figure_add [row2, Z], row2]]",
|
|
163
|
+
"# [[[]], [[]]]",
|
|
164
|
+
"; [size_equivalent [figure_mul [U, row2], row2], size_equivalent [figure_mul [row2, U], row2]]",
|
|
165
|
+
"# [[[]], [[]]]",
|
|
166
|
+
"; [size_equivalent [figure_add [figure_add [row2, row3], row4], figure_add [row2, figure_add [row3, row4]]], size_equivalent [figure_add [row2, row3], figure_add [row3, row2]]]",
|
|
167
|
+
"# [[[]], [[]]]",
|
|
168
|
+
"; size_equivalent [figure_mul [figure_mul [row2, row3], row4], figure_mul [row2, figure_mul [row3, row4]]]",
|
|
169
|
+
"# [[]]",
|
|
170
|
+
"; [size_equivalent [figure_mul [row2, figure_add [row3, row4]], figure_add [figure_mul [row2, row3], figure_mul [row2, row4]]], size_equivalent [figure_mul [figure_add [row2, row3], row4], figure_add [figure_mul [row2, row4], figure_mul [row3, row4]]]]",
|
|
171
|
+
"# [[[]], [[]]]",
|
|
172
|
+
"; [size_equivalent [figure_mul [Z, row3], Z], size_equivalent [figure_mul [row3, Z], Z]]",
|
|
173
|
+
"# [[[]], [[]]]",
|
|
174
|
+
"```",
|
|
175
|
+
"Sameness has two rungs. Sameness of form is `=`, and sameness of the",
|
|
176
|
+
"constructed Figure is `===`, which 30c recorded as unanswerable in v0.16.0",
|
|
177
|
+
"```",
|
|
178
|
+
"; .sameform {((_ .0) = (_ .1)) ? {B} : {A}};",
|
|
179
|
+
"; .sameness {((_ .0) === (_ .1)) ? {B} : {A}};",
|
|
180
|
+
"; sameform [B, [A]]",
|
|
181
|
+
"# [[]]",
|
|
182
|
+
"; sameness [B, B]",
|
|
183
|
+
"# [[]]",
|
|
184
|
+
"; sameness [B, [A]]",
|
|
185
|
+
"# []",
|
|
186
|
+
"; sameness [(E .0), A]",
|
|
187
|
+
"# [[]]",
|
|
188
|
+
"; .B2 [A];",
|
|
189
|
+
"; [B = B2, B == B2, B === B2]",
|
|
190
|
+
"# [<>, <>, ()]",
|
|
191
|
+
"```",
|
|
192
|
+
"Withness asks whether all requested Figures are immediate children of one",
|
|
193
|
+
"parent. It uses identity `===`, not equal-looking form: `B` is reused under both",
|
|
194
|
+
"`E` and `F`, while the separately constructed `B2` is not a child of either",
|
|
195
|
+
"```",
|
|
196
|
+
"; .absent {(figs & {(((parent & {(_ === __) ? {[<>]}}) | []) = []) ? {[<>]}}) | []};",
|
|
197
|
+
"; .withness {((absent _) = []) ? {B} : {A}};",
|
|
198
|
+
"; withness [.parent E; .figs [A, B];]",
|
|
199
|
+
"# [[]]",
|
|
200
|
+
"; withness [.parent F; .figs [A, B];]",
|
|
201
|
+
"# []",
|
|
202
|
+
"; withness [.parent G; .figs [E, F];]",
|
|
203
|
+
"# [[]]",
|
|
204
|
+
"; withness [.parent E; .figs [B2];]",
|
|
205
|
+
"# []",
|
|
206
|
+
"```",
|
|
207
|
+
"Both edges follow from the empty reduce answering its receiver. An empty parent",
|
|
208
|
+
"holds nothing, so no Figure is with it; and every one of no Figures is a child of",
|
|
209
|
+
"any parent, so asking about none answers yes",
|
|
210
|
+
"```",
|
|
211
|
+
"; [withness [.parent A; .figs [B];], withness [.parent B; .figs [];]]",
|
|
212
|
+
"# [[], [[]]]",
|
|
213
|
+
"```",
|
|
214
|
+
"The Fano construction starts with seven Figures of identical form: each original",
|
|
215
|
+
"is a fresh `[]`, so all seven triples below have the same form `[[], [], []]`.",
|
|
216
|
+
"The incidence pattern lives only in which originals each triple reuses, and",
|
|
217
|
+
"Withness checks that common immediate containment by identity. Under structural",
|
|
218
|
+
"`=` every original would be a child of every triple. `b_copy` is one more fresh",
|
|
219
|
+
"`[]`, equal in form to every original and a child of no triple",
|
|
220
|
+
"```",
|
|
221
|
+
"; .a []; .b []; .c []; .d []; .e []; .f []; .g [];",
|
|
222
|
+
"; .originals [a, b, c, d, e, f, g];",
|
|
223
|
+
"; .abd [a, b, d]; .bce [b, c, e]; .cdf [c, d, f];",
|
|
224
|
+
"; .deg [d, e, g]; .efa [e, f, a]; .fgb [f, g, b]; .gac [g, a, c];",
|
|
225
|
+
"; .fano [abd, bce, cdf, deg, efa, fgb, gac];",
|
|
226
|
+
"; .Three [U, U, U];",
|
|
227
|
+
"; [many originals, (many originals) = (many fano)]",
|
|
228
|
+
"# [[[[]], [[]], [[]], [[]], [[]], [[]], [[]]], <>]",
|
|
229
|
+
"; (fano & {many _}) = (fano & {Three})",
|
|
230
|
+
"# <>",
|
|
231
|
+
"; [abd = bce, abd === bce]",
|
|
232
|
+
"# [<>, ()]",
|
|
233
|
+
"; [sameform [a, b], sameness [a, b], sameness [b, b]]",
|
|
234
|
+
"# [[[]], [], [[]]]",
|
|
235
|
+
"; .b_copy [];",
|
|
236
|
+
"; b = b_copy",
|
|
237
|
+
"# <>",
|
|
238
|
+
"; sameness [b, b_copy]",
|
|
239
|
+
"# []",
|
|
240
|
+
"; withness [.parent abd; .figs [a, b, d];]",
|
|
241
|
+
"# [[]]",
|
|
242
|
+
"; withness [.parent abd; .figs [a, c];]",
|
|
243
|
+
"# []",
|
|
244
|
+
"; withness [.parent abd; .figs [b_copy];]",
|
|
245
|
+
"# []",
|
|
246
|
+
"```",
|
|
247
|
+
"Incidence is a table. `on` answers, for each triple, whether it holds every",
|
|
248
|
+
"requested original, so its Size counts the triples that do. `point_table`",
|
|
249
|
+
"applies it to every ordered pair of originals, generated with the Cartesian",
|
|
250
|
+
"idiom of 005.30b rather than listed, so the check is exhaustive by",
|
|
251
|
+
"construction. Two distinct originals lie in exactly one triple, and each",
|
|
252
|
+
"original lies in three",
|
|
253
|
+
"```",
|
|
254
|
+
"; .on {fano & {withness [.parent _; .figs __;]}};",
|
|
255
|
+
"; .point_table (originals & {.p _; originals & {size (on [p, _])}});",
|
|
256
|
+
"; point_table = (originals & {.p _; originals & {(p === _) ? {Three} : {[U]}}})",
|
|
257
|
+
"# <>",
|
|
258
|
+
"```",
|
|
259
|
+
"Dually, `meet` counts the originals two triples share. For each original,",
|
|
260
|
+
"multiplying its two Figure-valued Withness answers leaves one cell exactly when",
|
|
261
|
+
"both triples hold it. Two distinct triples share exactly one original, and each",
|
|
262
|
+
"triple holds three. The two tables are equal, which is the plane's",
|
|
263
|
+
"self-duality",
|
|
264
|
+
"```",
|
|
265
|
+
"; .meet {size (originals & {figure_mul [withness [.parent (__ .0); .figs [_];], withness [.parent (__ .1); .figs [_];]]})};",
|
|
266
|
+
"; .line_table (fano & {.l _; fano & {meet [l, _]}});",
|
|
267
|
+
"; line_table = (fano & {.l _; fano & {(l === _) ? {Three} : {[U]}}})",
|
|
268
|
+
"# <>",
|
|
269
|
+
"; point_table = line_table",
|
|
270
|
+
"# <>",
|
|
271
|
+
"```",
|
|
272
|
+
"Finally `a, b, c, f` are four originals with no three in a triple. All four of",
|
|
273
|
+
"their 3-subsets are listed, and no triple holds any of them",
|
|
274
|
+
"```",
|
|
275
|
+
"; [[a, b, c], [a, b, f], [a, c, f], [b, c, f]] & {size (on _)}",
|
|
276
|
+
"# [[], [], [], []]",
|
|
277
|
+
"```",
|
|
278
|
+
"Both results use the bracket as their sole `Figure(children...)` constructor.",
|
|
279
|
+
"HC, not the Figure theory, supplies child addressing and `&`/`|` traversal,",
|
|
280
|
+
"closure calls, recursion and conditional control, fresh aggregate allocation,",
|
|
281
|
+
"reference reuse and copy-on-write behavior, structural `=`, and identity",
|
|
282
|
+
"`===`. The corpus derives Manyness, Size, Size-equivalence, the Figure-valued",
|
|
283
|
+
"operations, Sameness, Withness, and the finite incidence checks from those",
|
|
284
|
+
"services. The semiring uses only form; identity enters where the Fano pattern",
|
|
285
|
+
"needs it, in Sameness and Withness. Multiplication invokes no copy primitive:",
|
|
286
|
+
"its identity assertions show that it reuses `row3`. `b_copy` is a fresh bracket",
|
|
287
|
+
"construction, not a derived copy operation. Neither the semiring laws nor the",
|
|
288
|
+
"Fano pattern is claimed for arbitrary Figure observations outside the stated",
|
|
289
|
+
"quotient and construction.",
|
|
290
|
+
"Observation does not mutate, even with a local name inside a map",
|
|
291
|
+
"```",
|
|
292
|
+
"; E = [A, B]",
|
|
293
|
+
"# <>",
|
|
294
|
+
"; .E5 [A, [A]];",
|
|
295
|
+
"; E5 & {.o _; o};",
|
|
296
|
+
"; E5",
|
|
297
|
+
"# [[], [[]]]",
|
|
298
|
+
"; A",
|
|
299
|
+
"# []",
|
|
300
|
+
"```",
|
|
301
|
+
"005.30b's Cartesian product, executed verbatim. The grid is one source element,",
|
|
302
|
+
"so `Figure` is applied once and the answer has the grid as its sole child",
|
|
303
|
+
"```",
|
|
304
|
+
"; .Pa [“a”, “b”]; .Pb [“c”, “d”];",
|
|
305
|
+
"; [(Pa & { Pb & { [__, _] } })] | Figure",
|
|
306
|
+
"# [[[[“a”, “c”], [“a”, “d”]], [[“b”, “c”], [“b”, “d”]]]]",
|
|
307
|
+
"; (many ([(Pa & { Pb & { [__, _] } })] | Figure)) = [U]",
|
|
308
|
+
"# <>",
|
|
309
|
+
"; (([(Pa & { Pb & { [__, _] } })] | Figure) .0) = (Pa & { Pb & { [__, _] } })",
|
|
310
|
+
"# <>",
|
|
311
|
+
"; (many (Pa & { Pb & { [__, _] } })) = [U, U]",
|
|
312
|
+
"# <>",
|
|
313
|
+
"",
|
|
314
|
+
].join("\n"),
|
|
315
|
+
],
|
|
316
|
+
]);
|
package/esm/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.20.1";
|