@mark1russell7/vex-compiler 0.13.3 → 0.13.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/build/index.d.ts +11 -19
- package/build/index.d.ts.map +1 -1
- package/build/index.js +364 -85
- package/build/index.js.map +1 -1
- package/package.json +4 -4
- package/src/facts.ts +37 -10
- package/src/module.ts +333 -78
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Addr, AnyDomain, Axis, CellFormulas, CompileOptions, Envelope, Expr, ExtHandler, FreeFn, PrimitiveKind, Program, Space } from "@mark1russell7/vex";
|
|
2
|
-
//#region src/facts.d.ts
|
|
3
2
|
/** The function of an op of a domain, or a method. */
|
|
4
3
|
type Method = (...args: unknown[]) => unknown;
|
|
5
4
|
/**
|
|
@@ -7,12 +6,22 @@ type Method = (...args: unknown[]) => unknown;
|
|
|
7
6
|
* the domain `Name` without a primitive type (KIND.DOMAIN).
|
|
8
7
|
*/
|
|
9
8
|
type Kind = PrimitiveKind | `domain:${string}`;
|
|
9
|
+
/**
|
|
10
|
+
* The kind of a list: the kind of its items, which can be a list too. A column of lists of a module of a sheet has such a
|
|
11
|
+
* kind (COMPILE.MODULE.SHEET.LIST). With `texts`, a key of an item can be a key of a list literal or of `fill`, not the
|
|
12
|
+
* key of a record. A field of the schema can have such a kind too (COMPILE.MODULE.LIST.INPUT).
|
|
13
|
+
*/
|
|
14
|
+
interface ListKind {
|
|
15
|
+
readonly list: Kind | ListKind;
|
|
16
|
+
readonly texts?: boolean;
|
|
17
|
+
}
|
|
10
18
|
/**
|
|
11
19
|
* The kinds that a host declares (docs/COMPILER.md §3.2): the kind of each field of the records, and of each variable of
|
|
12
20
|
* the run. A read of a declared field or variable checks the kind. When the check fails, tier 1 evaluates the program.
|
|
21
|
+
* A field can hold a list (COMPILE.MODULE.LIST.INPUT). Tier 2 does not check the kind of such a field.
|
|
13
22
|
*/
|
|
14
23
|
interface Schema {
|
|
15
|
-
readonly fields?: Readonly<Record<string, Kind>>;
|
|
24
|
+
readonly fields?: Readonly<Record<string, Kind | ListKind>>;
|
|
16
25
|
readonly vars?: Readonly<Record<string, Kind>>;
|
|
17
26
|
}
|
|
18
27
|
/** The options of a program: the domains, the free functions and the extension handlers, and the schema of the host. */
|
|
@@ -22,8 +31,6 @@ interface Options {
|
|
|
22
31
|
readonly extensions?: Readonly<Record<string, ExtHandler>>;
|
|
23
32
|
readonly schema?: Schema;
|
|
24
33
|
}
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/loop.d.ts
|
|
27
34
|
/** The functions of the runtime that generated code calls. Each one gives `FALLBACK` for a value it cannot give. */
|
|
28
35
|
type RuntimeFn = "has" | "addr" | "table" | "keys" | "step" | "result" | "opts" | "rec" | "list" | "frozen" | "ext" | "var";
|
|
29
36
|
/** The primitive operations of the loop IR. They copy no arithmetic of a domain (§4.2). */
|
|
@@ -144,8 +151,6 @@ interface LoopProgram {
|
|
|
144
151
|
/** The constants, by index: literals, paths, addresses, axes and names. Generated code reads them by index (§5). */
|
|
145
152
|
readonly constants: readonly unknown[];
|
|
146
153
|
}
|
|
147
|
-
//#endregion
|
|
148
|
-
//#region src/tiers.d.ts
|
|
149
154
|
/** The options of the compiler: the options of `compile`, and the schema of the host (docs/COMPILER.md §3.2). */
|
|
150
155
|
type GenerateOptions = CompileOptions & {
|
|
151
156
|
readonly schema?: Schema;
|
|
@@ -198,8 +203,6 @@ interface TieredProgram extends Program {
|
|
|
198
203
|
* tier 2 makes no trace.
|
|
199
204
|
*/
|
|
200
205
|
export declare function tiered(source: Expr | Envelope, options?: GenerateOptions): TieredProgram;
|
|
201
|
-
//#endregion
|
|
202
|
-
//#region src/module.d.ts
|
|
203
206
|
/** The options of a standalone module. */
|
|
204
207
|
interface ModuleOptions {
|
|
205
208
|
readonly domains?: readonly AnyDomain[];
|
|
@@ -231,14 +234,6 @@ interface SheetModuleOptions extends ModuleOptions {
|
|
|
231
234
|
/** The budget of the stack of the search of a run, in estimated frames, as in `SheetRun`. The default is 3000. */
|
|
232
235
|
readonly budget?: number;
|
|
233
236
|
}
|
|
234
|
-
/**
|
|
235
|
-
* The kind of a column of lists in a module of a sheet (COMPILE.MODULE.SHEET.LIST): the kind of the items, which can be
|
|
236
|
-
* a list too. With `texts`, a key of an item can be the text of a key of a list literal.
|
|
237
|
-
*/
|
|
238
|
-
interface ListKind {
|
|
239
|
-
readonly list: Kind | ListKind;
|
|
240
|
-
readonly texts?: boolean;
|
|
241
|
-
}
|
|
242
237
|
/** The source of a standalone module, or the reason that the program cannot be one. */
|
|
243
238
|
type Emitted = {
|
|
244
239
|
readonly ok: true;
|
|
@@ -264,8 +259,6 @@ export declare function emitModule(source: Expr | Envelope, options: ModuleOptio
|
|
|
264
259
|
* cycle of reads gives `VEX_ERROR`.
|
|
265
260
|
*/
|
|
266
261
|
export declare function emitSheetModule(columns: ReadonlyMap<string, Expr>, options: SheetModuleOptions): Emitted;
|
|
267
|
-
//#endregion
|
|
268
|
-
//#region src/runtime.d.ts
|
|
269
262
|
/** The value of a program that stops at a failed check. */
|
|
270
263
|
export declare const FALLBACK: unique symbol;
|
|
271
264
|
type Fallback = typeof FALLBACK;
|
|
@@ -336,6 +329,5 @@ interface Runtime {
|
|
|
336
329
|
}
|
|
337
330
|
/** This function makes the runtime of one set of options. */
|
|
338
331
|
export declare function createRuntime(options: RuntimeOptions): Runtime;
|
|
339
|
-
//#endregion
|
|
340
332
|
export type { Emitted, Fallback, GenerateOptions, Generated, LExpr, LStmt, ListKind, LoopProgram, ModuleOptions, PrimOp, Runtime, RuntimeFn, RuntimeOptions, Schema, SheetModuleOptions, Tier2, TierStats, TieredProgram };
|
|
341
333
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/facts.ts","../src/loop.ts","../src/tiers.ts","../src/module.ts","../src/runtime.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/facts.ts","../src/loop.ts","../src/tiers.ts","../src/module.ts","../src/runtime.ts"],"mappings":";;KAqCY,aAAa;;;;;KAMb,OAAO;;;;;;UAaF;WACN,MAAM,OAAO;WACb;;;;;;;UAQM;WACN,SAAS,SAAS,eAAe,OAAO;WACxC,OAAO,SAAS,eAAe;;;UAIzB;WACN,mBAAmB;WACnB,MAAM,SAAS,eAAe;WAC9B,aAAa,SAAS,eAAe;WACrC,SAAS;;;KCzDR;;KAeA;;KA2BA;WACG;WAAqB;;WACrB;WAAqB;;WACrB;WAAmB;;WACnB;WAAoB;;WACpB;;WACA;WAAqB,gBAAgB;;WACrC;WAAoB,IAAI;WAAiB,eAAe;;WACxD;WAAoB,IAAI;WAAoB,eAAe;;WAK3D;WAAkB;WAAuB,eAAe;WAAkB,iBAAiB;;WAE3F;WAAoB;;WAEpB;WAAuB;WAAuB,gBAAgB,OAAO,OAAO;;;;;;;;;;;KAW/E;WACG;;WACA;WAAwB;WAAwB;aAAoB,MAAM;aAAgB,MAAM;;;WAChG;WAAqB;;;KAGxB;WAEG;WAAmB;WAAoB,OAAO;;WAE9C;WAAmB;WAAoB,OAAO;;WAE9C;WAAqB,IAAI;WAAgB;WAAyB,MAAM;;WAExE;WAAoB,MAAM;;WAC1B;WAAkB,MAAM;WAAgB,cAAc;WAAkB,aAAa;;WAKrF;WAAoB;WAAwB;WAAuB;WAAwB;WAAwB,MAAM;WAAgB,eAAe;;WAExJ;WAAqB;WAAwB,eAAe;;WAE5D;WAAsB;WAAwB,eAAe;;WAE7D;;WAEA;WAAoB;WAAoB,OAAO;;WAC/C;WAAsB,OAAO;;;UAG3B;WACN,eAAe;WACf;;WAEA;;;KCrHC,kBAAkB;WAA4B,SAAS;;;;;;KAUvD;WACG;WAAmB,SAAS;WAAsB;WAAyB,SAAS;;WACpF;WAAoB;;;KAGvB,SAAS,OAAO,OAAO,gBAAgB,MAAM,SAAS,sCA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