eliscript 0.0.4 → 0.1.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.
Files changed (192) hide show
  1. package/README.md +9 -8
  2. package/bootstrap/compiler/emitter.eli +161 -63
  3. package/bootstrap/host/check-cli.mjs +0 -1
  4. package/bootstrap/host/check-cli.mjs.map +1 -1
  5. package/bootstrap/host/compiler-session.eli +2 -1
  6. package/bootstrap/host/eliscript-cli.mjs +2 -9
  7. package/bootstrap/host/eliscript-cli.mjs.map +1 -1
  8. package/bootstrap/host/project-cli.mjs +1 -11
  9. package/bootstrap/host/project-cli.mjs.map +1 -1
  10. package/bootstrap/host/project.mjs +2 -8
  11. package/bootstrap/host/project.mjs.map +1 -1
  12. package/browser/README.md +1 -1
  13. package/compiler/README.md +2 -2
  14. package/compiler/eliscript-emitter.el +229 -85
  15. package/compiler/eliscript-ir-emitter.el +64 -34
  16. package/compiler/eliscript-project.el +20 -5
  17. package/dist/backends/async.mjs +1 -90
  18. package/dist/backends/async.mjs.map +1 -1
  19. package/dist/backends/binary.mjs +1 -91
  20. package/dist/backends/binary.mjs.map +1 -1
  21. package/dist/backends/capabilities.mjs +1 -90
  22. package/dist/backends/capabilities.mjs.map +1 -1
  23. package/dist/backends/elf.mjs +1 -90
  24. package/dist/backends/elf.mjs.map +1 -1
  25. package/dist/backends/managed.mjs +1 -94
  26. package/dist/backends/managed.mjs.map +1 -1
  27. package/dist/backends/memory.mjs +1 -90
  28. package/dist/backends/memory.mjs.map +1 -1
  29. package/dist/backends/native.mjs +1 -91
  30. package/dist/backends/native.mjs.map +1 -1
  31. package/dist/backends/numeric.mjs +1 -90
  32. package/dist/backends/numeric.mjs.map +1 -1
  33. package/dist/backends/optimize.mjs +1 -90
  34. package/dist/backends/optimize.mjs.map +1 -1
  35. package/dist/backends/regexp.mjs +1 -91
  36. package/dist/backends/regexp.mjs.map +1 -1
  37. package/dist/backends/sha256.mjs +2 -96
  38. package/dist/backends/sha256.mjs.map +1 -1
  39. package/dist/backends/wasm.mjs +1 -90
  40. package/dist/backends/wasm.mjs.map +1 -1
  41. package/dist/bootstrap/analyzer.mjs +1 -95
  42. package/dist/bootstrap/analyzer.mjs.map +1 -1
  43. package/dist/bootstrap/compiler.mjs +1 -105
  44. package/dist/bootstrap/compiler.mjs.map +1 -1
  45. package/dist/bootstrap/emitter.mjs +848 -807
  46. package/dist/bootstrap/emitter.mjs.map +1 -1
  47. package/dist/bootstrap/expander.mjs +1 -96
  48. package/dist/bootstrap/expander.mjs.map +1 -1
  49. package/dist/bootstrap/formatter.mjs +1 -104
  50. package/dist/bootstrap/formatter.mjs.map +1 -1
  51. package/dist/bootstrap/ir.mjs +18 -172
  52. package/dist/bootstrap/ir.mjs.map +1 -1
  53. package/dist/bootstrap/lower.mjs +1 -92
  54. package/dist/bootstrap/lower.mjs.map +1 -1
  55. package/dist/bootstrap/project.mjs +23 -209
  56. package/dist/bootstrap/project.mjs.map +1 -1
  57. package/dist/bootstrap/reader.mjs +1 -96
  58. package/dist/bootstrap/reader.mjs.map +1 -1
  59. package/dist/bootstrap/source-map.mjs +7 -112
  60. package/dist/bootstrap/source-map.mjs.map +1 -1
  61. package/dist/bootstrap/symbol.mjs +7 -114
  62. package/dist/bootstrap/symbol.mjs.map +1 -1
  63. package/dist/bootstrap/syntax.mjs +10 -176
  64. package/dist/bootstrap/syntax.mjs.map +1 -1
  65. package/dist/bootstrap/transient-analysis.mjs +1 -93
  66. package/dist/bootstrap/transient-analysis.mjs.map +1 -1
  67. package/dist/browser/compiler.js +105 -104
  68. package/dist/browser/loader.js +1 -1
  69. package/dist/browser/loader.mjs +5 -124
  70. package/dist/compiler-artifact.json +1 -1
  71. package/dist/host/compiler-session.mjs +205 -297
  72. package/dist/host/compiler-session.mjs.map +1 -1
  73. package/dist/host/compiler-tools.mjs +1 -91
  74. package/dist/host/compiler-tools.mjs.map +1 -1
  75. package/dist/literal-sources/runtime/core/order.eli +32 -10
  76. package/dist/literal-sources/runtime/core/sequence.eli +69 -28
  77. package/dist/literal-sources/runtime/core/vector.eli +2 -4
  78. package/dist/literal-sources/stdlib/managed-literal-protocols.eli +5 -5
  79. package/dist/literal-sources/stdlib/managed-literals.eli +1 -1
  80. package/dist/package.json +1 -0
  81. package/dist/runtime/math.mjs +62 -252
  82. package/dist/runtime/math.mjs.map +1 -1
  83. package/dist/runtime/prelude.mjs +95 -0
  84. package/dist/runtime/prelude.mjs.macro-origins.json +1 -0
  85. package/dist/runtime/prelude.mjs.map +1 -0
  86. package/dist/runtime/unicode-case-data.mjs +1 -95
  87. package/dist/runtime/unicode-case-data.mjs.map +1 -1
  88. package/dist/runtime/unicode-case.mjs +3 -97
  89. package/dist/runtime/unicode-case.mjs.map +1 -1
  90. package/dist/stage3-release.json +1 -1
  91. package/editor/README.md +9 -4
  92. package/editor/eliscript-abi.el +170 -0
  93. package/editor/eliscript-async.el +375 -0
  94. package/editor/eliscript-bind.el +822 -0
  95. package/editor/eliscript-compat.el +346 -0
  96. package/editor/eliscript-contract.el +334 -0
  97. package/editor/eliscript-data.el +1544 -0
  98. package/editor/eliscript-js.el +318 -0
  99. package/editor/eliscript-mode.el +1 -1
  100. package/editor/eliscript-module.el +340 -0
  101. package/editor/eliscript-repl.el +1 -1
  102. package/package.json +4 -1
  103. package/runtime/README.md +21 -1
  104. package/runtime/core/protocol-impl.mjs +1 -115
  105. package/runtime/core/protocol-impl.mjs.map +1 -1
  106. package/runtime/core/text-impl.mjs +1 -90
  107. package/runtime/core/text-impl.mjs.map +1 -1
  108. package/runtime/core/vector.eli +1 -1
  109. package/runtime/core/vector.mjs +0 -9
  110. package/runtime/emacs-compat.eli +5957 -0
  111. package/runtime/emacs-compat.mjs +13734 -0
  112. package/runtime/emacs-compat.mjs.map +1 -0
  113. package/runtime/math.mjs +62 -252
  114. package/runtime/math.mjs.map +1 -1
  115. package/runtime/prelude.eli +4 -0
  116. package/runtime/prelude.mjs +95 -0
  117. package/runtime/prelude.mjs.map +1 -0
  118. package/runtime/unicode-case-data.mjs +1 -95
  119. package/runtime/unicode-case-data.mjs.map +1 -1
  120. package/runtime/unicode-case.mjs +3 -97
  121. package/runtime/unicode-case.mjs.map +1 -1
  122. package/stdlib/managed-literals.eli +1 -1
  123. package/stdlib/managed-runtime-vector.eli +2 -4
  124. package/tools/backends/compiler-build.mjs +3 -93
  125. package/tools/backends/compiler-cli.mjs +2 -15
  126. package/tools/backends/compiler-corpus-bit.mjs +2 -95
  127. package/tools/backends/compiler-corpus-cli-adapters.mjs +1 -97
  128. package/tools/backends/compiler-corpus-debugging.mjs +2 -95
  129. package/tools/backends/compiler-corpus-emitter.mjs +1 -97
  130. package/tools/backends/compiler-corpus-execution.mjs +2 -108
  131. package/tools/backends/compiler-corpus-fuzz.mjs +2 -95
  132. package/tools/backends/compiler-corpus-host-context.mjs +2 -99
  133. package/tools/backends/compiler-corpus-identity-host.mjs +18 -123
  134. package/tools/backends/compiler-corpus-identity-value-adapters.mjs +0 -9
  135. package/tools/backends/compiler-corpus-literal-provider.mjs +1 -91
  136. package/tools/backends/compiler-corpus-managed-adapters.mjs +1 -99
  137. package/tools/backends/compiler-corpus-managed-fixtures.mjs +2 -113
  138. package/tools/backends/compiler-corpus-matchers.mjs +3 -106
  139. package/tools/backends/compiler-corpus-original-program.mjs +1 -91
  140. package/tools/backends/compiler-corpus-process.mjs +1 -92
  141. package/tools/backends/compiler-corpus-program-driver.mjs +1 -3
  142. package/tools/backends/compiler-corpus-project-adapters.mjs +1 -95
  143. package/tools/backends/compiler-corpus-project-entry-host.mjs +2 -92
  144. package/tools/backends/compiler-corpus-project-transport.mjs +1 -90
  145. package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1 -91
  146. package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1 -92
  147. package/tools/backends/compiler-corpus-raw-math-fixture.mjs +1 -91
  148. package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +1 -91
  149. package/tools/backends/compiler-corpus-reference.mjs +1 -90
  150. package/tools/backends/compiler-corpus-runtime-adapters.mjs +2 -110
  151. package/tools/backends/compiler-corpus-tools-cli.mjs +1 -95
  152. package/tools/backends/compiler-corpus-tools-reference.mjs +22 -163
  153. package/tools/backends/compiler-corpus.mjs +3 -125
  154. package/tools/backends/compiler-matrix.mjs +1 -92
  155. package/tools/backends/compiler-package-browser.mjs +1 -90
  156. package/tools/backends/compiler-package.mjs +3 -95
  157. package/tools/backends/compiler-unicode-profile-host.mjs +1 -91
  158. package/tools/backends/dist/bootstrap-js-stages.mjs +1 -91
  159. package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -1
  160. package/tools/backends/dist/managed-ir-inventory.mjs +1 -91
  161. package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -1
  162. package/tools/backends/dist/record-grid.mjs +1 -91
  163. package/tools/backends/dist/record-grid.mjs.map +1 -1
  164. package/tools/backends/dist/release-cli.mjs +4 -94
  165. package/tools/backends/dist/release-cli.mjs.map +1 -1
  166. package/tools/backends/dist/run-artifact.mjs +1 -91
  167. package/tools/backends/dist/run-artifact.mjs.map +1 -1
  168. package/tools/backends/eliscript/compiler-corpus-bit.eli +1 -0
  169. package/tools/backends/managed-foreign-binding.mjs +1 -95
  170. package/tools/backends/managed-host-lifecycle.mjs +1 -91
  171. package/tools/backends/managed-host-object-provider.mjs +18 -59
  172. package/tools/backends/managed-host-object-realm.mjs +1 -91
  173. package/tools/backends/managed-host-proxy.mjs +9 -18
  174. package/tools/backends/managed-host-runtime.mjs +3 -105
  175. package/tools/backends/managed-host.mjs +1 -104
  176. package/tools/backends/managed-module-graph.mjs +1 -97
  177. package/tools/backends/managed-runtime.mjs +1 -96
  178. package/tools/backends/managed-source-view.mjs +13 -108
  179. package/tools/backends/native-managed-runtime.mjs +1 -91
  180. package/tools/backends/native-memory.mjs +1 -91
  181. package/tools/backends/stage3-targets.mjs +1 -91
  182. package/tools/bootstrap-runtime.el +3 -2
  183. package/tools/project/project.eli +1 -1
  184. package/tools/testing/stdlib-bit-corpus-host.mjs +1 -90
  185. package/tools/testing/stdlib-bit.mjs +1 -90
  186. package/dist/bootstrap/package.json +0 -1
  187. package/dist/bootstrap/runtime/math.mjs +0 -1117
  188. package/dist/bootstrap/runtime/math.mjs.map +0 -1
  189. package/dist/bootstrap/runtime/unicode-case-data.mjs +0 -10125
  190. package/dist/bootstrap/runtime/unicode-case-data.mjs.map +0 -1
  191. package/dist/bootstrap/runtime/unicode-case.mjs +0 -281
  192. package/dist/bootstrap/runtime/unicode-case.mjs.map +0 -1
@@ -2,117 +2,23 @@
2
2
  import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
3
3
  var __eliscript_tdz_ready_0;
4
4
  function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("installed"); return installed; }
5
- function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("installed"); return __eliscript_const_error(); }
6
5
  var __eliscript_tdz_ready_1;
7
6
  function __eliscript_tdz_read_1() { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("intrinsic_string"); return intrinsic_string; }
8
- function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("intrinsic_string"); return __eliscript_const_error(); }
9
7
  var __eliscript_tdz_ready_2;
10
8
  function __eliscript_tdz_read_2() { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("intrinsic_code_point"); return intrinsic_code_point; }
11
- function __eliscript_tdz_write_2(__eliscript_tdz_value_2) { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("intrinsic_code_point"); return __eliscript_const_error(); }
12
9
  var __eliscript_tdz_ready_3;
13
10
  function __eliscript_tdz_read_3() { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("intrinsic_from_code_point"); return intrinsic_from_code_point; }
14
- function __eliscript_tdz_write_3(__eliscript_tdz_value_3) { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("intrinsic_from_code_point"); return __eliscript_const_error(); }
15
- import { c as __eliscript_at, d as __eliscript_at_direct } from "data:text/javascript;base64,dmFyIG09UmVmbGVjdC5hcHBseSx0dD1OdW1iZXIucHJvdG90eXBlLnZhbHVlT2Ysaj1OdW1iZXIucHJvdG90eXBlLnRvU3RyaW5nLFU9TnVtYmVyLG50PU9iamVjdC5jcmVhdGUsaD1CaWdJbnQsZXQ9RGF0YVZpZXcsb3Q9QXJyYXlCdWZmZXIsaXQ9RGF0YVZpZXcucHJvdG90eXBlLnNldEZsb2F0NjQsSj1EYXRhVmlldy5wcm90b3R5cGUuZ2V0VWludDMyLHJ0PVJhbmdlRXJyb3I7ZnVuY3Rpb24gY3QodCxuKXtsZXQgZT1oKG4pLG89aCh0KSxpPSIiO2lmKG88MG4pbz0tbztkb3tsZXQgZj1vJWU7aT0iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltVKGYpXStpLG8vPWV9d2hpbGUobyE9PTBuKTtyZXR1cm4gdDwwPyItIitpOml9ZnVuY3Rpb24gc3QodCxuKXtsZXQgZT1uZXcgZXQobmV3IG90KDgpKTttKGl0LGUsWzAsdCwhMV0pO2xldCBvPW0oSixlLFswLCExXSksaT1tKEosZSxbNCwhMV0pLGY9bz4+PjIwJjIwNDcsYj1vJjEwNDg1NzUscD1vPj4+MzEscj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_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
16
12
  const __eliscript_truthy = (value) => value !== false && value != null;
17
- const __eliscript_number_intrinsic = globalThis.Number;
18
- const __eliscript_bigint_intrinsic = globalThis.BigInt;
19
- const __eliscript_numeric_apply = globalThis.Reflect.apply;
20
- const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
21
- const __eliscript_numeric_error = globalThis.TypeError;
22
- const __eliscript_numeric_trim = globalThis.String.prototype.trim;
23
- const __eliscript_numeric_slice = globalThis.String.prototype.slice;
24
- const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
25
- const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
26
- const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
27
- const __eliscript_numeric_primitive = (value) => {
28
- if (!__eliscript_numeric_object(value)) return value;
29
- const exotic = value[__eliscript_numeric_symbol];
30
- if (exotic !== void 0 && exotic !== null) {
31
- const result = __eliscript_numeric_apply(exotic, value, ["number"]);
32
- if (!__eliscript_numeric_object(result)) return result;
33
- throw new __eliscript_numeric_error("Cannot convert object to primitive value");
34
- }
35
- for (let index = 0; index < 2; index++) {
36
- const method = value[index === 0 ? "valueOf" : "toString"];
37
- if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
38
- const result = __eliscript_numeric_apply(method, value, []);
39
- if (!__eliscript_numeric_object(result)) return result;
40
- }
41
- }
42
- throw new __eliscript_numeric_error("Cannot convert object to primitive value");
43
- };
44
- const __eliscript_to_number = (value) => {
45
- const primitive = __eliscript_numeric_primitive(value);
46
- if (typeof primitive === "string") {
47
- const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
48
- if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
49
- let first = 2;
50
- while (first < text.length && text[first] === "0") first++;
51
- if (first === text.length) return 0;
52
- const prefix = text[1];
53
- const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
54
- if (text.length - first > limit) return 1 / 0;
55
- const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
56
- return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
57
- }
58
- }
59
- return __eliscript_number_intrinsic(primitive);
60
- };
61
- const __eliscript_numeric = (value) => {
62
- if (typeof value === "number" || typeof value === "bigint") return value;
63
- const primitive = __eliscript_numeric_primitive(value);
64
- if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
65
- return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
66
- };
67
- const __eliscript_implicit_number = (value) => {
68
- if (typeof value === "number") return value;
69
- const primitive = __eliscript_numeric_primitive(value);
70
- if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
71
- return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
72
- };
73
- const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
74
- const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
75
- const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
76
- const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
77
- const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
78
- const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
79
- const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
80
- const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
81
- const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
82
- const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
83
- const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
84
- const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
85
- const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
86
- const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
87
- const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
88
- const __eliscript_numeric_relation = (operator, left, right) => {
89
- if (typeof left === "number" && typeof right === "number") {
90
- if (operator === "<") return left < right;
91
- if (operator === "<=") return left <= right;
92
- if (operator === ">") return left > right;
93
- return left >= right;
94
- }
95
- let a = __eliscript_numeric_primitive(left);
96
- let b = __eliscript_numeric_primitive(right);
97
- const x = typeof a, y = typeof b;
98
- if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
99
- a = __eliscript_numeric(a);
100
- b = __eliscript_numeric(b);
101
- }
102
- if (operator === "<") return a < b;
103
- if (operator === "<=") return a <= b;
104
- if (operator === ">") return a > b;
105
- return a >= b;
106
- };
107
13
 
108
14
  import * as data from "./unicode-case-data.mjs";
109
15
  const installed = new (globalThis.WeakMap)();
110
16
  __eliscript_tdz_ready_0 = true;
111
17
  const intrinsic_string = globalThis.String;
112
18
  __eliscript_tdz_ready_1 = true;
113
- const intrinsic_code_point = (((__eliscript_tdz_read_1()))["prototype"])["codePointAt"];
19
+ const intrinsic_code_point = ((intrinsic_string)["prototype"])["codePointAt"];
114
20
  __eliscript_tdz_ready_2 = true;
115
- const intrinsic_from_code_point = ((__eliscript_tdz_read_1()))["fromCodePoint"];
21
+ const intrinsic_from_code_point = (intrinsic_string)["fromCodePoint"];
116
22
  __eliscript_tdz_ready_3 = true;
117
23
  function point(text, index) {
118
24
  return __eliscript_at(Reflect, "apply")((__eliscript_tdz_read_2()), text, [index]);
@@ -1 +1 @@
1
- {"version":3,"file":"runtime/unicode-case.mjs","sources":["runtime/unicode-case.eli"],"sourcesContent":["(module eliscript.runtime.unicode-case\n (import \"./unicode-case-data.mjs\" :as data)\n\n ;; Ordinary Eliscript JavaScript uses the same Unicode 17 default as the\n ;; owned runtime. Explicit profile selection remains available below.\n ;; Tables are derived from the one maintained Unicode-3.0 region in memory.eli.\n (defconst installed (new globalThis.WeakMap))\n (defconst intrinsic-string globalThis.String)\n (defconst intrinsic-code-point (get (get intrinsic-string :prototype) :codePointAt))\n (defconst intrinsic-from-code-point (get intrinsic-string :fromCodePoint))\n\n (defun point (text index)\n (Reflect/apply intrinsic-code-point text (js-array index)))\n (defun characters (code)\n (Reflect/apply intrinsic-from-code-point intrinsic-string (js-array code)))\n (defun tables (version)\n (let ((suffix (cond ((= version 15.1) \"151\") ((= version 16) \"160\") ((= version 17) \"17\")\n (t (throw (new globalThis.TypeError \"Unicode case profile must be 15.1, 16, or 17\"))))))\n (js-object :upper (js-array (get data (+ \"unicode_case_data_upper_0_\" suffix))\n (get data (+ \"unicode_case_data_upper_1_\" suffix)) (get data (+ \"unicode_case_data_upper_2_\" suffix)))\n :lower (js-array (get data (+ \"unicode_case_data_lower_0_\" suffix))\n (get data (+ \"unicode_case_data_lower_1_\" suffix)) (get data (+ \"unicode_case_data_lower_2_\" suffix)))\n :cased (get data (+ \"unicode_case_data_cased_\" suffix))\n :ignorable (get data (+ \"unicode_case_data_case_ignorable_\" suffix)))))\n\n (defun final-sigma (text index before rules)\n (let ((result before) (done false))\n (while (and (= before 1) (not done) (< index (js-length text)))\n (let ((code (point text index)))\n (when (= (funcall (get rules :ignorable) code) 0)\n (setq done t)\n (when (= (funcall (get rules :cased) code) 1) (setq result 0)))\n (setq index (+ index (if (> code 65535) 2 1))))) result))\n\n (defun convert (text upper rules)\n (let* ((mapping (get rules (if upper \"upper\" \"lower\")))\n (first-map (aref mapping 0)) (second-map (aref mapping 1)) (third-map (aref mapping 2))\n (pieces (js-array)) (chunk \"\") (index 0) (before 0))\n (while (< index (js-length text))\n (let* ((code (point text index)) (step (if (> code 65535) 2 1))\n (first (funcall first-map code)) (second (funcall second-map code)) (third (funcall third-map code)))\n (when (and (not upper) (= code 931) (= (final-sigma text (+ index step) before rules) 1))\n (setq first 962))\n (setq chunk (+ chunk (characters first)))\n (when (/= second 0) (setq chunk (+ chunk (characters second))))\n (when (/= third 0) (setq chunk (+ chunk (characters third))))\n (when (>= (js-length chunk) 4096) (js-call pieces :push chunk) (setq chunk \"\"))\n (when (and (not upper) (= (funcall (get rules :ignorable) code) 0))\n (setq before (funcall (get rules :cased) code)))\n (setq index (+ index step))))\n (when (> (js-length chunk) 0) (js-call pieces :push chunk))\n (js-call pieces :join \"\")))\n\n (defun profile-method (name upper rules string-constructor function-prototype type-error)\n ;; An arrow target is intrinsically nonconstructible. Proxy [[Call]] gives\n ;; Eli the actual method receiver without embedded foreign-language code.\n (let ((target (lambda () undefined)))\n (Object/setPrototypeOf target function-prototype)\n (Object/defineProperty target \"name\" (js-object :value name :configurable t))\n (Object/defineProperty target \"length\" (js-object :value 0 :configurable t))\n (new globalThis.Proxy target (js-object :apply (lambda (ignored receiver arguments)\n (when (nullish? receiver)\n (throw (new type-error (+ \"String.prototype.\" name \" called on null or undefined\"))))\n ;; String(Symbol) has a special exception to abstract ToString; the\n ;; String prototype algorithms do not have that exception.\n (when (= (value-type receiver) \"symbol\")\n (throw (new type-error \"Cannot convert a Symbol value to a string\")))\n (let ((text (Reflect/apply string-constructor undefined (js-array receiver))))\n (convert text upper rules)))))))\n\n (defun installUnicodeCaseProfile (version &rest arguments)\n (let* ((rules (tables version))\n (requested-realm (if (= (js-length arguments) 0) undefined (aref arguments 0)))\n (realm (if (undefined? requested-realm) globalThis.globalThis requested-realm)))\n (unless (and realm (= (value-type (get realm :String)) \"function\")\n (= (value-type (get realm :Function)) \"function\")\n (= (value-type (get realm :TypeError)) \"function\"))\n (throw (new globalThis.TypeError \"Unicode case profile requires a real String realm\")))\n (let* ((string-constructor (get realm :String)) (prototype (get string-constructor :prototype))\n (function-prototype (get (get realm :Function) :prototype)) (type-error (get realm :TypeError))\n (previous (js-call installed :get prototype)))\n (if (and previous (= (get previous :version) version)) previous\n (let ((names (js-array \"toUpperCase\" \"toLowerCase\")) (index 0))\n ;; Check both ordinary intrinsic properties before publishing any\n ;; method, including the deleted-property/nonextensible boundary.\n (while (< index 2)\n (let ((descriptor (Object/getOwnPropertyDescriptor prototype (aref names index))))\n (when (if descriptor (not (get descriptor :configurable)) (not (Object/isExtensible prototype)))\n (throw (new type-error \"Unicode case profile cannot replace a fixed String method\"))))\n (setq index (1+ index)))\n (let* ((upper (profile-method \"toUpperCase\" t rules string-constructor function-prototype type-error))\n (lower (profile-method \"toLowerCase\" false rules string-constructor function-prototype type-error))\n (state (Object/freeze (js-object :version version :upper upper :lower lower))))\n (Object/defineProperty prototype \"toUpperCase\" (js-object :value upper :writable t :enumerable false :configurable t))\n (Object/defineProperty prototype \"toLowerCase\" (js-object :value lower :writable t :enumerable false :configurable t))\n (js-call installed :set prototype state) state))))))\n ;; ESM evaluation installs once, before the importing user module executes.\n ;; A later import is cached, so user getters, replacements and deletion remain.\n (installUnicodeCaseProfile 17)\n (export installUnicodeCaseProfile))\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACE,YAAsC;AAKtC,kBAAoB,KAAK;;AACzB,yBAA2B;;AAC3B,6BAA+B,CAAK,CAAK,4BAAiB,cAAY;;AACtE,kCAAoC,CAAK,4BAAiB;;AAE1D,eAAc,MAAK;EACjB,OAAA,eAAC,kBAAc,4BAAqB,MAAK,CAAU;;AACrD,oBAAmB;EACjB,OAAA,eAAC,kBAAc,4BAA0B,4BAAiB,CAAU;;AACtE,gBAAe;EACb;gCAAoB,CAAC,CAAG,YAAQ,QAAM,QAAO,CAAC,CAAG,YAAQ,MAAI,QAAO,CAAC,CAAG,YAAQ,MAAI,OAC7D,0DAAO,KAAK,sBAAqB;;UADlD;MAEJ,OAAA,EAAW,SAAO,CAAU,CAAK,MAAK,CAAG,+BAA6B,UAClE,CAAK,MAAK,CAAG,+BAA6B,UAAS,CAAK,MAAK,CAAG,+BAA6B,WAC/F,SAAO,CAAU,CAAK,MAAK,CAAG,+BAA6B,UACzD,CAAK,MAAK,CAAG,+BAA6B,UAAS,CAAK,MAAK,CAAG,+BAA6B,WAC/F,SAAO,CAAK,MAAK,CAAG,6BAA2B,UAC/C,aAAW,CAAK,MAAK,CAAG,sCAAoC;;;;AAElE,qBAAoB,MAAK,OAAM,QAAO;EACpC;gCAAc;gCAAc;;UAAtB;UAAgB;MACpB,OAAO,CAAK,CAAG,WAAO,MAAG,qBAAK,UAAM,kCAAG,OAAM,EAAW;QACtD;sCAAa,MAAM,MAAK;;gBAAlB;YACJ,IAAM,CAAG,CAAS,CAAK,OAAM,cAAY,UAAM;cAC7C,CAAM,CAAA,OAAK;cACX,IAAM,CA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O,QAAQ,eAAe,eAAc,MAAE,OAAM,oBAAmB,oBAAmB;kBACnF,QAAQ,eAAe,eAAc,OAAM,OAAM,oBAAmB,oBAAmB;kBACvF,QAAQ,cAAc,EAAW,WAAS,SAAQ,SAAO,OAAM,SAAO;cAC1E,sBAAsB,WAAU,eAAc,EAAW,SAAO,OAAM,YAAU,MAAE,cAAY,OAAM,gBAAc;cAClH,sBAAsB,WAAU,eAAc,EAAW,SAAO,OAAM,YAAU,MAAE,cAAY,OAAM,gBAAc;cACnH,CAAS,4BAAU,OAAK,WAAU;cAAO,OAAA;;;;;;;;AAGpD,0BAA0B;AAC3B,QAAQ"}
1
+ {"version":3,"file":"runtime/unicode-case.mjs","sources":["runtime/unicode-case.eli"],"sourcesContent":["(module eliscript.runtime.unicode-case\n (import \"./unicode-case-data.mjs\" :as data)\n\n ;; Ordinary Eliscript JavaScript uses the same Unicode 17 default as the\n ;; owned runtime. Explicit profile selection remains available below.\n ;; Tables are derived from the one maintained Unicode-3.0 region in memory.eli.\n (defconst installed (new globalThis.WeakMap))\n (defconst intrinsic-string globalThis.String)\n (defconst intrinsic-code-point (get (get intrinsic-string :prototype) :codePointAt))\n (defconst intrinsic-from-code-point (get intrinsic-string :fromCodePoint))\n\n (defun point (text index)\n (Reflect/apply intrinsic-code-point text (js-array index)))\n (defun characters (code)\n (Reflect/apply intrinsic-from-code-point intrinsic-string (js-array code)))\n (defun tables (version)\n (let ((suffix (cond ((= version 15.1) \"151\") ((= version 16) \"160\") ((= version 17) \"17\")\n (t (throw (new globalThis.TypeError \"Unicode case profile must be 15.1, 16, or 17\"))))))\n (js-object :upper (js-array (get data (+ \"unicode_case_data_upper_0_\" suffix))\n (get data (+ \"unicode_case_data_upper_1_\" suffix)) (get data (+ \"unicode_case_data_upper_2_\" suffix)))\n :lower (js-array (get data (+ \"unicode_case_data_lower_0_\" suffix))\n (get data (+ \"unicode_case_data_lower_1_\" suffix)) (get data (+ \"unicode_case_data_lower_2_\" suffix)))\n :cased (get data (+ \"unicode_case_data_cased_\" suffix))\n :ignorable (get data (+ \"unicode_case_data_case_ignorable_\" suffix)))))\n\n (defun final-sigma (text index before rules)\n (let ((result before) (done false))\n (while (and (= before 1) (not done) (< index (js-length text)))\n (let ((code (point text index)))\n (when (= (funcall (get rules :ignorable) code) 0)\n (setq done t)\n (when (= (funcall (get rules :cased) code) 1) (setq result 0)))\n (setq index (+ index (if (> code 65535) 2 1))))) result))\n\n (defun convert (text upper rules)\n (let* ((mapping (get rules (if upper \"upper\" \"lower\")))\n (first-map (aref mapping 0)) (second-map (aref mapping 1)) (third-map (aref mapping 2))\n (pieces (js-array)) (chunk \"\") (index 0) (before 0))\n (while (< index (js-length text))\n (let* ((code (point text index)) (step (if (> code 65535) 2 1))\n (first (funcall first-map code)) (second (funcall second-map code)) (third (funcall third-map code)))\n (when (and (not upper) (= code 931) (= (final-sigma text (+ index step) before rules) 1))\n (setq first 962))\n (setq chunk (+ chunk (characters first)))\n (when (/= second 0) (setq chunk (+ chunk (characters second))))\n (when (/= third 0) (setq chunk (+ chunk (characters third))))\n (when (>= (js-length chunk) 4096) (js-call pieces :push chunk) (setq chunk \"\"))\n (when (and (not upper) (= (funcall (get rules :ignorable) code) 0))\n (setq before (funcall (get rules :cased) code)))\n (setq index (+ index step))))\n (when (> (js-length chunk) 0) (js-call pieces :push chunk))\n (js-call pieces :join \"\")))\n\n (defun profile-method (name upper rules string-constructor function-prototype type-error)\n ;; An arrow target is intrinsically nonconstructible. Proxy [[Call]] gives\n ;; Eli the actual method receiver without embedded foreign-language code.\n (let ((target (lambda () undefined)))\n (Object/setPrototypeOf target function-prototype)\n (Object/defineProperty target \"name\" (js-object :value name :configurable t))\n (Object/defineProperty target \"length\" (js-object :value 0 :configurable t))\n (new globalThis.Proxy target (js-object :apply (lambda (ignored receiver arguments)\n (when (nullish? receiver)\n (throw (new type-error (+ \"String.prototype.\" name \" called on null or undefined\"))))\n ;; String(Symbol) has a special exception to abstract ToString; the\n ;; String prototype algorithms do not have that exception.\n (when (= (value-type receiver) \"symbol\")\n (throw (new type-error \"Cannot convert a Symbol value to a string\")))\n (let ((text (Reflect/apply string-constructor undefined (js-array receiver))))\n (convert text upper rules)))))))\n\n (defun installUnicodeCaseProfile (version &rest arguments)\n (let* ((rules (tables version))\n (requested-realm (if (= (js-length arguments) 0) undefined (aref arguments 0)))\n (realm (if (undefined? requested-realm) globalThis.globalThis requested-realm)))\n (unless (and realm (= (value-type (get realm :String)) \"function\")\n (= (value-type (get realm :Function)) \"function\")\n (= (value-type (get realm :TypeError)) \"function\"))\n (throw (new globalThis.TypeError \"Unicode case profile requires a real String realm\")))\n (let* ((string-constructor (get realm :String)) (prototype (get string-constructor :prototype))\n (function-prototype (get (get realm :Function) :prototype)) (type-error (get realm :TypeError))\n (previous (js-call installed :get prototype)))\n (if (and previous (= (get previous :version) version)) previous\n (let ((names (js-array \"toUpperCase\" \"toLowerCase\")) (index 0))\n ;; Check both ordinary intrinsic properties before publishing any\n ;; method, including the deleted-property/nonextensible boundary.\n (while (< index 2)\n (let ((descriptor (Object/getOwnPropertyDescriptor prototype (aref names index))))\n (when (if descriptor (not (get descriptor :configurable)) (not (Object/isExtensible prototype)))\n (throw (new type-error \"Unicode case profile cannot replace a fixed String method\"))))\n (setq index (1+ index)))\n (let* ((upper (profile-method \"toUpperCase\" t rules string-constructor function-prototype type-error))\n (lower (profile-method \"toLowerCase\" false rules string-constructor function-prototype type-error))\n (state (Object/freeze (js-object :version version :upper upper :lower lower))))\n (Object/defineProperty prototype \"toUpperCase\" (js-object :value upper :writable t :enumerable false :configurable t))\n (Object/defineProperty prototype \"toLowerCase\" (js-object :value lower :writable t :enumerable false :configurable t))\n (js-call installed :set prototype state) state))))))\n ;; ESM evaluation installs once, before the importing user module executes.\n ;; A later import is cached, so user getters, replacements and deletion remain.\n (installUnicodeCaseProfile 17)\n (export installUnicodeCaseProfile))\n"],"names":[],"mappings":";;;;;;;;;;;;;AACE,YAAsC;AAKtC,kBAAoB,KAAK;;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AU,MAAE,cAAY,OAAM,gBAAc;cACnH,CAAS,4BAAU,OAAK,WAAU;cAAO,OAAA;;;;;;;;AAGpD,0BAA0B;AAC3B,QAAQ"}
@@ -309,7 +309,7 @@
309
309
  (defun literal-vector (&rest values)
310
310
  (literal-initialize-prototype 2)
311
311
  (when (<= (js-length values) 32) (funcall literal-object-freeze values))
312
- (literal-vector-from-array-values values))
312
+ (js-call PersistentVector :from values))
313
313
  (defun literal-map (&rest values)
314
314
  (when (/= (% (js-length values) 2) 0) (literal-fail "hash-map expects complete key/value pairs"))
315
315
  (let ((entries (js-array)) (index 0) (pair 0))
@@ -6,10 +6,8 @@
6
6
  (defconst view-states (new globalThis/WeakMap))
7
7
  (defconst freeze Object/freeze)
8
8
  (defun persistentVector (&rest values)
9
- (if (= (js-length values) 0) EMPTY_VECTOR
10
- (progn
11
- (when (<= (js-length values) 32) (funcall freeze values))
12
- (literal-vector-from-array-values values))))
9
+ (when (<= (js-length values) 32) (funcall freeze values))
10
+ (js-call PersistentVector :from values))
13
11
  (defun isPersistentVector (value) (literal-instance? value PersistentVector))
14
12
  (defun subvec (vector start &optional end) (literal-subvec vector start end))
15
13
  (defun readPersistentVectorView (value)
@@ -2,101 +2,10 @@
2
2
  import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
3
3
  var __eliscript_tdz_ready_0;
4
4
  function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("independentCompilerProfiles"); return independentCompilerProfiles; }
5
- function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("independentCompilerProfiles"); return __eliscript_const_error(); }
6
5
  import "eliscript/runtime/unicode-case.mjs";
7
6
  import "eliscript/runtime/math.mjs";
8
- import { c as __eliscript_at, d as __eliscript_at_direct } from "data:text/javascript;base64,dmFyIG09UmVmbGVjdC5hcHBseSx0dD1OdW1iZXIucHJvdG90eXBlLnZhbHVlT2Ysaj1OdW1iZXIucHJvdG90eXBlLnRvU3RyaW5nLFU9TnVtYmVyLG50PU9iamVjdC5jcmVhdGUsaD1CaWdJbnQsZXQ9RGF0YVZpZXcsb3Q9QXJyYXlCdWZmZXIsaXQ9RGF0YVZpZXcucHJvdG90eXBlLnNldEZsb2F0NjQsSj1EYXRhVmlldy5wcm90b3R5cGUuZ2V0VWludDMyLHJ0PVJhbmdlRXJyb3I7ZnVuY3Rpb24gY3QodCxuKXtsZXQgZT1oKG4pLG89aCh0KSxpPSIiO2lmKG88MG4pbz0tbztkb3tsZXQgZj1vJWU7aT0iMDEyMzQ1Njc4OWFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6IltVKGYpXStpLG8vPWV9d2hpbGUobyE9PTBuKTtyZXR1cm4gdDwwPyItIitpOml9ZnVuY3Rpb24gc3QodCxuKXtsZXQgZT1uZXcgZXQobmV3IG90KDgpKTttKGl0LGUsWzAsdCwhMV0pO2xldCBvPW0oSixlLFswLCExXSksaT1tKEosZSxbNCwhMV0pLGY9bz4+PjIwJjIwNDcsYj1vJjEwNDg1NzUscD1vPj4+MzEscj1oKGIpPDwzMm58aChpKTtpZihmIT09MClyKz0xbjw8NTJuO3I8PD0ybjtsZXQgbD00bix1PWY+MSYmYj09PTAmJmk9PT0wPzFuOjJuLGs9Mm47aWYoZj49MTA3NSl7bGV0IGM9aChmLTEwNzUpO3I8PD1jLHU8PD1jLG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0pe2lmKCFBKG4pKXJldHVybiBzKHQsbixlKTtsZXQgbz1uLGk9eShlLDApO2U9WChlLDEpLHQ9byxuPWk7Y29udGludWV9aWYodD09PU4pe2lmKCFBKG4pKXJldHVybiBzKHQsbixlKTtsZXQgbz1uLGk9eShlLDApO2U9Wih5KGUsMSksITApLHQ9byxuPWk7Y29udGludWV9aWYodD09PXMpe2xldCBvPXkoZSwwKSxpPXkoZSwxKTtpZighQShvKSlyZXR1cm4gcyh0LG4sZSk7ZT1aKHkoZSwyKSwhMSksdD1vLG49aTtjb250aW51ZX1pZih0PT09RSl7bGV0IG89cyh0LG4sZSk7aWYobiE9PWomJm4hPT1LJiZuIT09eiYmbiE9PU0mJm4hPT1OJiZuIT09cyYmbiE9PUUpcmV0dXJuIG87bGV0IGk9bixmPXkoZSwwKSxiPVgoZSwxKSxwPSguLi51KT0+TChpLGYsU3QoYix1KSk7VChwLHB0LHt2YWx1ZToodSk9PnUgaW5zdGFuY2VvZiBpLGNvbmZpZ3VyYWJsZTohMH0pO2xldCByPXMoRSxwLFt2b2lkIDBdKTt1dChyLGZ0KG8pKTtsZXQgbD1hdChvKTtmb3IobGV0IHU9MDt1PGwubGVuZ3RoO3UrKylUKHIsbFt1XSxsdChvLGxbdV0pKTtyZXR1cm4gcn1yZXR1cm4gcyh0LG4sZSl9fWZ1bmN0aW9uIFJ0KHQsbil7bGV0IGU9dFtuXTtyZXR1cm4oLi4ubyk9PkwoZSx0LG8pfWZ1bmN0aW9uIEF0KHQsbiwuLi5lKXtsZXQgbz10W25dO3JldHVybiBMKG8sdCxlKX1leHBvcnR7UnQgYXMgYyxBdCBhcyBkfTs=";
7
+ import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
9
8
  const __eliscript_truthy = (value) => value !== false && value != null;
10
- const __eliscript_number_intrinsic = globalThis.Number;
11
- const __eliscript_bigint_intrinsic = globalThis.BigInt;
12
- const __eliscript_numeric_apply = globalThis.Reflect.apply;
13
- const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
14
- const __eliscript_numeric_error = globalThis.TypeError;
15
- const __eliscript_numeric_trim = globalThis.String.prototype.trim;
16
- const __eliscript_numeric_slice = globalThis.String.prototype.slice;
17
- const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
18
- const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
19
- const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
20
- const __eliscript_numeric_primitive = (value) => {
21
- if (!__eliscript_numeric_object(value)) return value;
22
- const exotic = value[__eliscript_numeric_symbol];
23
- if (exotic !== void 0 && exotic !== null) {
24
- const result = __eliscript_numeric_apply(exotic, value, ["number"]);
25
- if (!__eliscript_numeric_object(result)) return result;
26
- throw new __eliscript_numeric_error("Cannot convert object to primitive value");
27
- }
28
- for (let index = 0; index < 2; index++) {
29
- const method = value[index === 0 ? "valueOf" : "toString"];
30
- if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
31
- const result = __eliscript_numeric_apply(method, value, []);
32
- if (!__eliscript_numeric_object(result)) return result;
33
- }
34
- }
35
- throw new __eliscript_numeric_error("Cannot convert object to primitive value");
36
- };
37
- const __eliscript_to_number = (value) => {
38
- const primitive = __eliscript_numeric_primitive(value);
39
- if (typeof primitive === "string") {
40
- const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
41
- if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
42
- let first = 2;
43
- while (first < text.length && text[first] === "0") first++;
44
- if (first === text.length) return 0;
45
- const prefix = text[1];
46
- const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
47
- if (text.length - first > limit) return 1 / 0;
48
- const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
49
- return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
50
- }
51
- }
52
- return __eliscript_number_intrinsic(primitive);
53
- };
54
- const __eliscript_numeric = (value) => {
55
- if (typeof value === "number" || typeof value === "bigint") return value;
56
- const primitive = __eliscript_numeric_primitive(value);
57
- if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
58
- return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
59
- };
60
- const __eliscript_implicit_number = (value) => {
61
- if (typeof value === "number") return value;
62
- const primitive = __eliscript_numeric_primitive(value);
63
- if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
64
- return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
65
- };
66
- const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
67
- const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
68
- const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
69
- const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
70
- const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
71
- const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
72
- const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
73
- const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
74
- const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
75
- const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
76
- const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
77
- const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
78
- const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
79
- const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
80
- const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
81
- const __eliscript_numeric_relation = (operator, left, right) => {
82
- if (typeof left === "number" && typeof right === "number") {
83
- if (operator === "<") return left < right;
84
- if (operator === "<=") return left <= right;
85
- if (operator === ">") return left > right;
86
- return left >= right;
87
- }
88
- let a = __eliscript_numeric_primitive(left);
89
- let b = __eliscript_numeric_primitive(right);
90
- const x = typeof a, y = typeof b;
91
- if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
92
- a = __eliscript_numeric(a);
93
- b = __eliscript_numeric(b);
94
- }
95
- if (operator === "<") return a < b;
96
- if (operator === "<=") return a <= b;
97
- if (operator === ">") return a > b;
98
- return a >= b;
99
- };
100
9
 
101
10
  import {mkdir, readFile, readdir, writeFile, open} from "node:fs/promises";
102
11
  import {writeSync} from "node:fs";
@@ -292,6 +201,7 @@ async function loadCompilerSources(...arguments$) {
292
201
  ((group_index = (group_index + 1)));
293
202
  }
294
203
  (records)["push"](({"id": "runtime/math.mjs", "filename": "runtime/math.eli"}));
204
+ (records)["push"](({"id": "runtime/prelude.mjs", "filename": "runtime/prelude.eli"}));
295
205
  (records)["push"](({"id": "runtime/unicode-case.mjs", "filename": "runtime/unicode-case.eli"}));
296
206
  (records)["push"](({"id": "runtime/unicode-case-data.mjs", "filename": "runtime/unicode-case-data.eli"}));
297
207
  ((index = 0));
@@ -434,7 +344,7 @@ async function write_compiler_math_scope(directory) {
434
344
  })());
435
345
  return path;
436
346
  })());
437
- })((String(JSON.stringify(({"name": "eliscript", "type": "module", "private": true, "exports": ({"./runtime/math.mjs": "./runtime/math.mjs", "./runtime/unicode-case.mjs": "./runtime/unicode-case.mjs", "./runtime/unicode-case-data.mjs": "./runtime/unicode-case-data.mjs"})}), null, 2)) + String("\n"))));
347
+ })((String(JSON.stringify(({"name": "eliscript", "type": "module", "private": true, "exports": ({"./runtime/math.mjs": "./runtime/math.mjs", "./runtime/prelude.mjs": "./runtime/prelude.mjs", "./runtime/unicode-case.mjs": "./runtime/unicode-case.mjs", "./runtime/unicode-case-data.mjs": "./runtime/unicode-case-data.mjs"})}), null, 2)) + String("\n"))));
438
348
  })(resolve(directory, "package.json")));
439
349
  }
440
350
  async function write_compiler_seed_scope(directory) {
@@ -1,14 +1,4 @@
1
1
  // Generated by Eliscript. Do not edit.
2
- import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
3
- var __eliscript_tdz_ready_0;
4
- function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("main"); return main; }
5
- function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("main"); return __eliscript_const_error(); }
6
- var __eliscript_tdz_ready_1;
7
- function __eliscript_tdz_read_1() { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("runCompilerCLI"); return runCompilerCLI; }
8
- function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("runCompilerCLI"); return __eliscript_const_error(); }
9
- var __eliscript_tdz_ready_2;
10
- function __eliscript_tdz_read_2() { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("renderCompilerCLIError"); return renderCompilerCLIError; }
11
- function __eliscript_tdz_write_2(__eliscript_tdz_value_2) { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("renderCompilerCLIError"); return __eliscript_const_error(); }
12
2
  import "eliscript/runtime/unicode-case.mjs";
13
3
  const __eliscript_truthy = (value) => value !== false && value != null;
14
4
 
@@ -16,13 +6,10 @@ import {resolve} from "node:path";
16
6
  import {fileURLToPath} from "node:url";
17
7
  import {runReleaseCLI, renderReleaseCLIError} from "./dist/release-cli.mjs";
18
8
  const main = runReleaseCLI;
19
- __eliscript_tdz_ready_0 = true;
20
9
  const runCompilerCLI = runReleaseCLI;
21
- __eliscript_tdz_ready_1 = true;
22
10
  const renderCompilerCLIError = renderReleaseCLIError;
23
- __eliscript_tdz_ready_2 = true;
24
- (__eliscript_truthy(((__eliscript_value_1) => (__eliscript_truthy(__eliscript_value_1) ? (resolve(((globalThis.process)["argv"])[1]) === fileURLToPath(import.meta.url)) : __eliscript_value_1))(((globalThis.process)["argv"])[1])) ? ((__eliscript_tdz_read_0())(((globalThis.process)["argv"])["slice"](2)))["catch"](((error) => {
25
- ((globalThis.process)["stderr"])["write"](((__eliscript_tdz_read_2())(error, ({"json": ((globalThis.process)["argv"])["includes"]("--json-errors")})) + "\n"));
11
+ (__eliscript_truthy(((__eliscript_value_1) => (__eliscript_truthy(__eliscript_value_1) ? (resolve(((globalThis.process)["argv"])[1]) === fileURLToPath(import.meta.url)) : __eliscript_value_1))(((globalThis.process)["argv"])[1])) ? (main(((globalThis.process)["argv"])["slice"](2)))["catch"](((error) => {
12
+ ((globalThis.process)["stderr"])["write"]((renderCompilerCLIError(error, ({"json": ((globalThis.process)["argv"])["includes"]("--json-errors")})) + "\n"));
26
13
  return ((globalThis.process)["exitCode"] = 1);
27
14
  })) : null);
28
15
  export {main, runCompilerCLI, renderCompilerCLIError};
@@ -2,108 +2,15 @@
2
2
  import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "data:text/javascript;base64,Y29uc3QgRSA9IFJlZmVyZW5jZUVycm9yOyBjb25zdCBUID0gVHlwZUVycm9yOyBleHBvcnQgZnVuY3Rpb24gdGR6KG5hbWUpIHsgdGhyb3cgbmV3IEUoIkNhbm5vdCBhY2Nlc3MgJyIgKyBuYW1lICsgIicgYmVmb3JlIGluaXRpYWxpemF0aW9uIik7IH0gZXhwb3J0IGZ1bmN0aW9uIGltbXV0YWJsZSgpIHsgdGhyb3cgbmV3IFQoIkFzc2lnbm1lbnQgdG8gY29uc3RhbnQgdmFyaWFibGUuIik7IH0K";
3
3
  var __eliscript_tdz_ready_0;
4
4
  function __eliscript_tdz_read_0() { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("id"); return id; }
5
- function __eliscript_tdz_write_0(__eliscript_tdz_value_0) { if (__eliscript_tdz_ready_0 !== true) __eliscript_tdz_error("id"); return __eliscript_const_error(); }
6
5
  var __eliscript_tdz_ready_1;
7
6
  function __eliscript_tdz_read_1() { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("suite"); return suite; }
8
- function __eliscript_tdz_write_1(__eliscript_tdz_value_1) { if (__eliscript_tdz_ready_1 !== true) __eliscript_tdz_error("suite"); return __eliscript_const_error(); }
9
7
  var __eliscript_tdz_ready_2;
10
8
  function __eliscript_tdz_read_2() { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("suite_sha"); return suite_sha; }
11
- function __eliscript_tdz_write_2(__eliscript_tdz_value_2) { if (__eliscript_tdz_ready_2 !== true) __eliscript_tdz_error("suite_sha"); return __eliscript_const_error(); }
12
9
  var __eliscript_tdz_ready_3;
13
10
  function __eliscript_tdz_read_3() { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("files"); return files; }
14
- function __eliscript_tdz_write_3(__eliscript_tdz_value_3) { if (__eliscript_tdz_ready_3 !== true) __eliscript_tdz_error("files"); return __eliscript_const_error(); }
15
11
  import "eliscript/runtime/unicode-case.mjs";
12
+ import { __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
16
13
  const __eliscript_truthy = (value) => value !== false && value != null;
17
- const __eliscript_number_intrinsic = globalThis.Number;
18
- const __eliscript_bigint_intrinsic = globalThis.BigInt;
19
- const __eliscript_numeric_apply = globalThis.Reflect.apply;
20
- const __eliscript_numeric_symbol = globalThis.Symbol.toPrimitive;
21
- const __eliscript_numeric_error = globalThis.TypeError;
22
- const __eliscript_numeric_trim = globalThis.String.prototype.trim;
23
- const __eliscript_numeric_slice = globalThis.String.prototype.slice;
24
- const __eliscript_numeric_exec = globalThis.RegExp.prototype.exec;
25
- const __eliscript_numeric_radix = /^(?:0[xX][0-9a-fA-F]+|0[oO][0-7]+|0[bB][01]+)$/;
26
- const __eliscript_numeric_object = (value) => value !== null && (typeof value === "object" || typeof value === "function" || (typeof value === "undefined" && value !== void 0));
27
- const __eliscript_numeric_primitive = (value) => {
28
- if (!__eliscript_numeric_object(value)) return value;
29
- const exotic = value[__eliscript_numeric_symbol];
30
- if (exotic !== void 0 && exotic !== null) {
31
- const result = __eliscript_numeric_apply(exotic, value, ["number"]);
32
- if (!__eliscript_numeric_object(result)) return result;
33
- throw new __eliscript_numeric_error("Cannot convert object to primitive value");
34
- }
35
- for (let index = 0; index < 2; index++) {
36
- const method = value[index === 0 ? "valueOf" : "toString"];
37
- if (typeof method === "function" || (typeof method === "undefined" && method !== void 0)) {
38
- const result = __eliscript_numeric_apply(method, value, []);
39
- if (!__eliscript_numeric_object(result)) return result;
40
- }
41
- }
42
- throw new __eliscript_numeric_error("Cannot convert object to primitive value");
43
- };
44
- const __eliscript_to_number = (value) => {
45
- const primitive = __eliscript_numeric_primitive(value);
46
- if (typeof primitive === "string") {
47
- const text = __eliscript_numeric_apply(__eliscript_numeric_trim, primitive, []);
48
- if (__eliscript_numeric_apply(__eliscript_numeric_exec, __eliscript_numeric_radix, [text]) !== null) {
49
- let first = 2;
50
- while (first < text.length && text[first] === "0") first++;
51
- if (first === text.length) return 0;
52
- const prefix = text[1];
53
- const limit = prefix === "x" || prefix === "X" ? 256 : prefix === "b" || prefix === "B" ? 1024 : 342;
54
- if (text.length - first > limit) return 1 / 0;
55
- const token = __eliscript_numeric_apply(__eliscript_numeric_slice, text, [0, 2]) + __eliscript_numeric_apply(__eliscript_numeric_slice, text, [first]);
56
- return __eliscript_number_intrinsic(__eliscript_bigint_intrinsic(token));
57
- }
58
- }
59
- return __eliscript_number_intrinsic(primitive);
60
- };
61
- const __eliscript_numeric = (value) => {
62
- if (typeof value === "number" || typeof value === "bigint") return value;
63
- const primitive = __eliscript_numeric_primitive(value);
64
- if (typeof primitive === "number" || typeof primitive === "bigint") return primitive;
65
- return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
66
- };
67
- const __eliscript_implicit_number = (value) => {
68
- if (typeof value === "number") return value;
69
- const primitive = __eliscript_numeric_primitive(value);
70
- if (typeof primitive === "bigint") throw new __eliscript_numeric_error("Cannot convert a BigInt value to a number");
71
- return typeof primitive === "string" ? __eliscript_to_number(primitive) : +primitive;
72
- };
73
- const __eliscript_numeric_decrement = (value) => __eliscript_implicit_number(value) - 1;
74
- const __eliscript_numeric_sub = (a, b) => { if (typeof a === "number" && typeof b === "number") return a - b; return __eliscript_numeric(a) - __eliscript_numeric(b); };
75
- const __eliscript_numeric_mul = (a, b) => { if (typeof a === "number" && typeof b === "number") return a * b; return __eliscript_numeric(a) * __eliscript_numeric(b); };
76
- const __eliscript_numeric_div = (a, b) => { if (typeof a === "number" && typeof b === "number") return a / b; return __eliscript_numeric(a) / __eliscript_numeric(b); };
77
- const __eliscript_numeric_rem = (a, b) => { if (typeof a === "number" && typeof b === "number") return a % b; return __eliscript_numeric(a) % __eliscript_numeric(b); };
78
- const __eliscript_numeric_and = (a, b) => { if (typeof a === "number" && typeof b === "number") return a & b; return __eliscript_numeric(a) & __eliscript_numeric(b); };
79
- const __eliscript_numeric_or = (a, b) => { if (typeof a === "number" && typeof b === "number") return a | b; return __eliscript_numeric(a) | __eliscript_numeric(b); };
80
- const __eliscript_numeric_xor = (a, b) => { if (typeof a === "number" && typeof b === "number") return a ^ b; return __eliscript_numeric(a) ^ __eliscript_numeric(b); };
81
- const __eliscript_numeric_shl = (a, b) => { if (typeof a === "number" && typeof b === "number") return a << b; return __eliscript_numeric(a) << __eliscript_numeric(b); };
82
- const __eliscript_numeric_shr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >> b; return __eliscript_numeric(a) >> __eliscript_numeric(b); };
83
- const __eliscript_numeric_ushr = (a, b) => { if (typeof a === "number" && typeof b === "number") return a >>> b; return __eliscript_numeric(a) >>> __eliscript_numeric(b); };
84
- const __eliscript_numeric_neg = (a) => typeof a === "number" ? -a : -__eliscript_numeric(a);
85
- const __eliscript_numeric_int32 = (a) => typeof a === "number" ? a | 0 : __eliscript_numeric(a) | 0;
86
- const __eliscript_numeric_uint32 = (a) => typeof a === "number" ? a >>> 0 : __eliscript_numeric(a) >>> 0;
87
- const __eliscript_numeric_not = (a) => typeof a === "number" ? ~a : ~__eliscript_numeric(a);
88
- const __eliscript_numeric_relation = (operator, left, right) => {
89
- if (typeof left === "number" && typeof right === "number") {
90
- if (operator === "<") return left < right;
91
- if (operator === "<=") return left <= right;
92
- if (operator === ">") return left > right;
93
- return left >= right;
94
- }
95
- let a = __eliscript_numeric_primitive(left);
96
- let b = __eliscript_numeric_primitive(right);
97
- const x = typeof a, y = typeof b;
98
- if (!((x === "string" && y === "string") || (x === "bigint" && y === "string") || (x === "string" && y === "bigint"))) {
99
- a = __eliscript_numeric(a);
100
- b = __eliscript_numeric(b);
101
- }
102
- if (operator === "<") return a < b;
103
- if (operator === "<=") return a <= b;
104
- if (operator === ">") return a > b;
105
- return a >= b;
106
- };
107
14
 
108
15
  import {createHash} from "node:crypto";
109
16
  import {Buffer} from "node:buffer";
@@ -115,7 +22,7 @@ const suite = "tests/stdlib-bit.test.mjs";
115
22
  __eliscript_tdz_ready_1 = true;
116
23
  const suite_sha = "c550405d71455b5ce694c929b63b6a0843ea637f5b35ccf221afd5780ce16771";
117
24
  __eliscript_tdz_ready_2 = true;
118
- const files = ["tools/backends/eliscript/compiler-corpus-bit.eli", "tools/backends/compiler-corpus-bit.mjs", "tests/stdlib-bit.test.mjs", "tests/eliscript/stdlib-bit.eli", "tests/stdlib-bit-selfhosted.test.mjs", "tools/testing/stdlib-bit.eli", "tools/testing/stdlib-bit.mjs", "tools/testing/stdlib-bit-corpus-host.eli", "tools/testing/stdlib-bit-corpus-host.mjs", "tests/helpers/seed-compiler.mjs", "tools/backends/build.mjs", "package.json", "stdlib/bit.eli", "tests/fixtures/bit-usage.eli", "tests/fixtures/bit-host.mjs", "runtime/math.eli", "runtime/math.mjs", "runtime/math.mjs.map", "runtime/unicode-case.eli", "runtime/unicode-case.mjs", "runtime/unicode-case.mjs.map", "runtime/unicode-case-data.eli", "runtime/unicode-case-data.mjs", "runtime/unicode-case-data.mjs.map"];
25
+ const files = ["tools/backends/eliscript/compiler-corpus-bit.eli", "tools/backends/compiler-corpus-bit.mjs", "tests/stdlib-bit.test.mjs", "tests/eliscript/stdlib-bit.eli", "tests/stdlib-bit-selfhosted.test.mjs", "tools/testing/stdlib-bit.eli", "tools/testing/stdlib-bit.mjs", "tools/testing/stdlib-bit-corpus-host.eli", "tools/testing/stdlib-bit-corpus-host.mjs", "tests/helpers/seed-compiler.mjs", "tools/backends/build.mjs", "package.json", "stdlib/bit.eli", "tests/fixtures/bit-usage.eli", "tests/fixtures/bit-host.mjs", "runtime/math.eli", "runtime/math.mjs", "runtime/math.mjs.map", "runtime/prelude.eli", "runtime/prelude.mjs", "runtime/prelude.mjs.map", "runtime/unicode-case.eli", "runtime/unicode-case.mjs", "runtime/unicode-case.mjs.map", "runtime/unicode-case-data.eli", "runtime/unicode-case-data.mjs", "runtime/unicode-case-data.mjs.map"];
119
26
  __eliscript_tdz_ready_3 = true;
120
27
  function hash(value) {
121
28
  return ((createHash("sha256"))["update"](value))["digest"]("hex");