eliscript 0.0.1 → 0.0.3

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 (417) hide show
  1. package/README.md +61 -0
  2. package/bootstrap/README.md +26 -0
  3. package/bootstrap/backends/README.md +515 -0
  4. package/bootstrap/backends/async.eli +230 -0
  5. package/bootstrap/backends/binary.eli +173 -0
  6. package/bootstrap/backends/capabilities.eli +74 -0
  7. package/bootstrap/backends/elf.eli +246 -0
  8. package/bootstrap/backends/managed.eli +5976 -0
  9. package/bootstrap/backends/memory.eli +100 -0
  10. package/bootstrap/backends/native.eli +2000 -0
  11. package/bootstrap/backends/numeric.eli +1362 -0
  12. package/bootstrap/backends/optimize.eli +79 -0
  13. package/bootstrap/backends/regexp.eli +2263 -0
  14. package/bootstrap/backends/sha256.eli +138 -0
  15. package/bootstrap/backends/wasm.eli +1161 -0
  16. package/bootstrap/compiler/analyzer.eli +165 -77
  17. package/bootstrap/compiler/compiler.eli +43 -19
  18. package/bootstrap/compiler/emitter.eli +780 -170
  19. package/bootstrap/compiler/expander.eli +136 -45
  20. package/bootstrap/compiler/formatter.eli +8 -1
  21. package/bootstrap/compiler/ir.eli +148 -45
  22. package/bootstrap/compiler/lower.eli +29 -2
  23. package/bootstrap/compiler/project.eli +51 -21
  24. package/bootstrap/compiler/reader.eli +128 -36
  25. package/bootstrap/compiler/source-map.eli +46 -4
  26. package/bootstrap/compiler/symbol.eli +2 -1
  27. package/bootstrap/compiler/syntax.eli +47 -12
  28. package/bootstrap/compiler/transient-analysis.eli +40 -4
  29. package/bootstrap/host/check-cli-legacy.mjs +163 -0
  30. package/bootstrap/host/check-cli.mjs +59 -158
  31. package/bootstrap/host/check-cli.mjs.map +1 -0
  32. package/bootstrap/host/compiler-session.eli +1579 -0
  33. package/bootstrap/host/compiler-tools.eli +513 -0
  34. package/bootstrap/host/eliscript-cli.mjs +53 -33
  35. package/bootstrap/host/eliscript-cli.mjs.map +1 -0
  36. package/bootstrap/host/project-cli-legacy.mjs +295 -0
  37. package/bootstrap/host/project-cli.mjs +74 -289
  38. package/bootstrap/host/project-cli.mjs.map +1 -0
  39. package/bootstrap/host/project-legacy.mjs +1080 -0
  40. package/bootstrap/host/project.mjs +210 -1060
  41. package/bootstrap/host/project.mjs.map +1 -0
  42. package/bootstrap/runtime/UNICODE-LICENSE.txt +39 -0
  43. package/bootstrap/runtime/memory.eli +30379 -0
  44. package/browser/host.mjs +732 -11
  45. package/browser/worker.mjs +6 -3
  46. package/compiler/eliscript-analyzer.el +371 -4
  47. package/compiler/eliscript-cli.el +84 -1
  48. package/compiler/eliscript-emitter.el +1189 -256
  49. package/compiler/eliscript-expander.el +147 -10
  50. package/compiler/eliscript-ir-emitter.el +725 -208
  51. package/compiler/eliscript-lower.el +127 -1
  52. package/compiler/eliscript-portable.el +177 -51
  53. package/compiler/eliscript-project.el +20 -2
  54. package/compiler/eliscript-reader.el +141 -57
  55. package/compiler/eliscript-source-map.el +26 -12
  56. package/compiler/eliscript-transient-analysis.el +382 -19
  57. package/dist/backends/async.mjs +561 -0
  58. package/dist/backends/async.mjs.macro-origins.json +1 -0
  59. package/dist/backends/async.mjs.map +1 -0
  60. package/dist/backends/binary.mjs +381 -0
  61. package/dist/backends/binary.mjs.macro-origins.json +1 -0
  62. package/dist/backends/binary.mjs.map +1 -0
  63. package/dist/backends/capabilities.mjs +237 -0
  64. package/dist/backends/capabilities.mjs.macro-origins.json +1 -0
  65. package/dist/backends/capabilities.mjs.map +1 -0
  66. package/dist/backends/elf.mjs +540 -0
  67. package/dist/backends/elf.mjs.macro-origins.json +1 -0
  68. package/dist/backends/elf.mjs.map +1 -0
  69. package/dist/backends/managed.mjs +10616 -0
  70. package/dist/backends/managed.mjs.macro-origins.json +1 -0
  71. package/dist/backends/managed.mjs.map +1 -0
  72. package/dist/backends/memory.mjs +278 -0
  73. package/dist/backends/memory.mjs.macro-origins.json +1 -0
  74. package/dist/backends/memory.mjs.map +1 -0
  75. package/dist/backends/native.mjs +4099 -0
  76. package/dist/backends/native.mjs.macro-origins.json +1 -0
  77. package/dist/backends/native.mjs.map +1 -0
  78. package/dist/backends/numeric.mjs +2458 -0
  79. package/dist/backends/numeric.mjs.macro-origins.json +1 -0
  80. package/dist/backends/numeric.mjs.map +1 -0
  81. package/dist/backends/optimize.mjs +204 -0
  82. package/dist/backends/optimize.mjs.macro-origins.json +1 -0
  83. package/dist/backends/optimize.mjs.map +1 -0
  84. package/dist/backends/regexp.mjs +2033 -0
  85. package/dist/backends/regexp.mjs.macro-origins.json +1 -0
  86. package/dist/backends/regexp.mjs.map +1 -0
  87. package/dist/backends/sha256.mjs +310 -0
  88. package/dist/backends/sha256.mjs.macro-origins.json +1 -0
  89. package/dist/backends/sha256.mjs.map +1 -0
  90. package/dist/backends/wasm.mjs +2258 -0
  91. package/dist/backends/wasm.mjs.macro-origins.json +1 -0
  92. package/dist/backends/wasm.mjs.map +1 -0
  93. package/dist/bootstrap/analyzer.mjs +1908 -776
  94. package/dist/bootstrap/analyzer.mjs.macro-origins.json +1 -0
  95. package/dist/bootstrap/analyzer.mjs.map +1 -1
  96. package/dist/bootstrap/compiler.mjs +450 -142
  97. package/dist/bootstrap/compiler.mjs.macro-origins.json +1 -0
  98. package/dist/bootstrap/compiler.mjs.map +1 -1
  99. package/dist/bootstrap/emitter.mjs +3083 -909
  100. package/dist/bootstrap/emitter.mjs.macro-origins.json +1 -0
  101. package/dist/bootstrap/emitter.mjs.map +1 -1
  102. package/dist/bootstrap/expander.mjs +2887 -1233
  103. package/dist/bootstrap/expander.mjs.macro-origins.json +1 -0
  104. package/dist/bootstrap/expander.mjs.map +1 -1
  105. package/dist/bootstrap/formatter.mjs +582 -218
  106. package/dist/bootstrap/formatter.mjs.macro-origins.json +1 -0
  107. package/dist/bootstrap/formatter.mjs.map +1 -1
  108. package/dist/bootstrap/ir.mjs +670 -116
  109. package/dist/bootstrap/ir.mjs.macro-origins.json +1 -0
  110. package/dist/bootstrap/ir.mjs.map +1 -1
  111. package/dist/bootstrap/lower.mjs +866 -257
  112. package/dist/bootstrap/lower.mjs.macro-origins.json +1 -0
  113. package/dist/bootstrap/lower.mjs.map +1 -1
  114. package/dist/bootstrap/package.json +1 -0
  115. package/dist/bootstrap/project.mjs +1168 -498
  116. package/dist/bootstrap/project.mjs.macro-origins.json +1 -0
  117. package/dist/bootstrap/project.mjs.map +1 -1
  118. package/dist/bootstrap/reader.mjs +674 -175
  119. package/dist/bootstrap/reader.mjs.macro-origins.json +1 -0
  120. package/dist/bootstrap/reader.mjs.map +1 -1
  121. package/dist/bootstrap/runtime/math.mjs +1117 -0
  122. package/dist/bootstrap/runtime/math.mjs.map +1 -0
  123. package/dist/bootstrap/runtime/unicode-case-data.mjs +10125 -0
  124. package/dist/bootstrap/runtime/unicode-case-data.mjs.map +1 -0
  125. package/dist/bootstrap/runtime/unicode-case.mjs +281 -0
  126. package/dist/bootstrap/runtime/unicode-case.mjs.map +1 -0
  127. package/dist/bootstrap/source-map.mjs +430 -119
  128. package/dist/bootstrap/source-map.mjs.macro-origins.json +1 -0
  129. package/dist/bootstrap/source-map.mjs.map +1 -1
  130. package/dist/bootstrap/symbol.mjs +229 -53
  131. package/dist/bootstrap/symbol.mjs.macro-origins.json +1 -0
  132. package/dist/bootstrap/symbol.mjs.map +1 -1
  133. package/dist/bootstrap/syntax.mjs +205 -7
  134. package/dist/bootstrap/syntax.mjs.macro-origins.json +1 -0
  135. package/dist/bootstrap/syntax.mjs.map +1 -1
  136. package/dist/bootstrap/transient-analysis.mjs +1185 -489
  137. package/dist/bootstrap/transient-analysis.mjs.macro-origins.json +1 -0
  138. package/dist/bootstrap/transient-analysis.mjs.map +1 -1
  139. package/dist/browser/compiler.js +199 -6478
  140. package/dist/browser/host.mjs +1078 -0
  141. package/dist/browser/loader.js +1 -0
  142. package/dist/browser/loader.mjs +231 -0
  143. package/dist/browser/worker.mjs +63 -0
  144. package/dist/compiler-artifact.json +1 -0
  145. package/dist/host/compiler-session.mjs +2980 -0
  146. package/dist/host/compiler-session.mjs.macro-origins.json +1 -0
  147. package/dist/host/compiler-session.mjs.map +1 -0
  148. package/dist/host/compiler-tools.mjs +1084 -0
  149. package/dist/host/compiler-tools.mjs.macro-origins.json +1 -0
  150. package/dist/host/compiler-tools.mjs.map +1 -0
  151. package/dist/literal-sources/runtime/core/collection-internals.eli +60 -0
  152. package/dist/literal-sources/runtime/core/collection.eli +639 -0
  153. package/dist/literal-sources/runtime/core/data-text.eli +290 -0
  154. package/dist/literal-sources/runtime/core/data.eli +22 -0
  155. package/dist/literal-sources/runtime/core/identifier.eli +44 -0
  156. package/dist/literal-sources/runtime/core/lazy-sequence.eli +131 -0
  157. package/dist/literal-sources/runtime/core/list.eli +19 -0
  158. package/dist/literal-sources/runtime/core/map.eli +9 -0
  159. package/dist/literal-sources/runtime/core/metadata-internals.eli +6 -0
  160. package/dist/literal-sources/runtime/core/metadata.eli +40 -0
  161. package/dist/literal-sources/runtime/core/object.eli +8 -0
  162. package/dist/literal-sources/runtime/core/order.eli +123 -0
  163. package/dist/literal-sources/runtime/core/persistent-kind.eli +28 -0
  164. package/dist/literal-sources/runtime/core/protocol-error.eli +32 -0
  165. package/dist/literal-sources/runtime/core/protocol.eli +28 -0
  166. package/dist/literal-sources/runtime/core/queue.eli +9 -0
  167. package/dist/literal-sources/runtime/core/record.eli +191 -0
  168. package/dist/literal-sources/runtime/core/regex.eli +158 -0
  169. package/dist/literal-sources/runtime/core/sequence.eli +305 -0
  170. package/dist/literal-sources/runtime/core/set-algebra.eli +28 -0
  171. package/dist/literal-sources/runtime/core/set.eli +9 -0
  172. package/dist/literal-sources/runtime/core/sorted.eli +408 -0
  173. package/dist/literal-sources/runtime/core/text.eli +14 -0
  174. package/dist/literal-sources/runtime/core/transducer.eli +268 -0
  175. package/dist/literal-sources/runtime/core/transient.eli +17 -0
  176. package/dist/literal-sources/runtime/core/truth.eli +4 -0
  177. package/dist/literal-sources/runtime/core/type.eli +232 -0
  178. package/dist/literal-sources/runtime/core/value-internals.eli +13 -0
  179. package/dist/literal-sources/runtime/core/value.eli +19 -0
  180. package/dist/literal-sources/runtime/core/vector.eli +25 -0
  181. package/dist/literal-sources/runtime/literals.eli +23 -0
  182. package/dist/literal-sources/runtime/testing/value.eli +6 -0
  183. package/dist/literal-sources/runtime/wire/http-rpc.eli +362 -0
  184. package/dist/literal-sources/runtime/wire/markdown.eli +275 -0
  185. package/dist/literal-sources/runtime/wire/schema.eli +193 -0
  186. package/dist/literal-sources/stdlib/bit.eli +36 -0
  187. package/dist/literal-sources/stdlib/core/data.eli +306 -0
  188. package/dist/literal-sources/stdlib/core/object.eli +89 -0
  189. package/dist/literal-sources/stdlib/core/protocol.eli +451 -0
  190. package/dist/literal-sources/stdlib/core/set.eli +312 -0
  191. package/dist/literal-sources/stdlib/core/text.eli +103 -0
  192. package/dist/literal-sources/stdlib/managed-literal-protocols.eli +494 -0
  193. package/dist/literal-sources/stdlib/managed-literals.eli +1469 -0
  194. package/dist/literal-sources/stdlib/managed-queue-state.eli +65 -0
  195. package/dist/literal-sources/stdlib/managed-sorted-state.eli +233 -0
  196. package/dist/literal-sources/stdlib/managed-transient-state.eli +348 -0
  197. package/dist/literal-sources/stdlib/managed-value-state.eli +153 -0
  198. package/dist/literal-sources/stdlib/managed-vector-view-state.eli +102 -0
  199. package/dist/literal-sources/stdlib/persistent-list.eli +145 -0
  200. package/dist/literal-sources/stdlib/persistent-map.eli +724 -0
  201. package/dist/literal-sources/stdlib/persistent-set.eli +236 -0
  202. package/dist/literal-sources/stdlib/persistent-vector.eli +359 -0
  203. package/dist/literal-sources/stdlib/value.eli +325 -0
  204. package/dist/package.json +10 -0
  205. package/dist/runtime/math.mjs +1116 -0
  206. package/dist/runtime/math.mjs.macro-origins.json +1 -0
  207. package/dist/runtime/math.mjs.map +1 -0
  208. package/dist/runtime/unicode-case-data.mjs +10124 -0
  209. package/dist/runtime/unicode-case-data.mjs.macro-origins.json +1 -0
  210. package/dist/runtime/unicode-case-data.mjs.map +1 -0
  211. package/dist/runtime/unicode-case.mjs +280 -0
  212. package/dist/runtime/unicode-case.mjs.macro-origins.json +1 -0
  213. package/dist/runtime/unicode-case.mjs.map +1 -0
  214. package/dist/runtime.eli +30379 -0
  215. package/dist/stage3-release.json +1 -0
  216. package/editor/README.md +1 -1
  217. package/editor/eliscript-mode.el +1 -1
  218. package/editor/eliscript-repl.el +1 -1
  219. package/package.json +106 -11
  220. package/platform/http.mjs +20 -0
  221. package/runtime/array-text.mjs +159 -0
  222. package/runtime/core/map-internals.mjs +27 -9
  223. package/runtime/core/object-impl.mjs +26 -17
  224. package/runtime/core/object-impl.mjs.map +1 -1
  225. package/runtime/core/protocol-impl.mjs +682 -255
  226. package/runtime/core/protocol-impl.mjs.map +1 -1
  227. package/runtime/core/protocol.mjs +4 -0
  228. package/runtime/core/record.mjs +23 -2
  229. package/runtime/core/regex.mjs +4 -0
  230. package/runtime/core/sorted.mjs +53 -0
  231. package/runtime/core/text-impl.mjs +167 -48
  232. package/runtime/core/text-impl.mjs.map +1 -1
  233. package/runtime/core/type.mjs +75 -3
  234. package/runtime/core/vector.mjs +6 -0
  235. package/runtime/math.eli +429 -0
  236. package/runtime/math.mjs +1116 -0
  237. package/runtime/math.mjs.map +1 -0
  238. package/runtime/number-radix.mjs +105 -0
  239. package/runtime/unicode-case-data.eli +29 -0
  240. package/runtime/unicode-case-data.mjs +10124 -0
  241. package/runtime/unicode-case-data.mjs.map +1 -0
  242. package/runtime/unicode-case.eli +100 -0
  243. package/runtime/unicode-case.mjs +280 -0
  244. package/runtime/unicode-case.mjs.map +1 -0
  245. package/runtime/wire/http-rpc.mjs +168 -0
  246. package/runtime/wire/markdown.mjs +196 -0
  247. package/runtime/wire/schema.mjs +109 -0
  248. package/stdlib/README.md +54 -0
  249. package/stdlib/core/protocol.eli +81 -17
  250. package/stdlib/core/seq.eli +1 -1
  251. package/stdlib/core/zipper.eli +172 -72
  252. package/stdlib/gepo.eli +12 -0
  253. package/stdlib/interop/js.eli +56 -15
  254. package/stdlib/managed-literal-protocols.eli +494 -0
  255. package/stdlib/managed-literals.eli +1469 -0
  256. package/stdlib/managed-protocol-error.eli +32 -0
  257. package/stdlib/managed-queue-state.eli +65 -0
  258. package/stdlib/managed-runtime-collection-internals.eli +60 -0
  259. package/stdlib/managed-runtime-collection.eli +639 -0
  260. package/stdlib/managed-runtime-data-text.eli +290 -0
  261. package/stdlib/managed-runtime-data.eli +22 -0
  262. package/stdlib/managed-runtime-identifier.eli +44 -0
  263. package/stdlib/managed-runtime-lazy-sequence.eli +131 -0
  264. package/stdlib/managed-runtime-list.eli +19 -0
  265. package/stdlib/managed-runtime-literals.eli +23 -0
  266. package/stdlib/managed-runtime-map.eli +9 -0
  267. package/stdlib/managed-runtime-metadata-internals.eli +6 -0
  268. package/stdlib/managed-runtime-metadata.eli +40 -0
  269. package/stdlib/managed-runtime-object.eli +8 -0
  270. package/stdlib/managed-runtime-order.eli +123 -0
  271. package/stdlib/managed-runtime-persistent-kind.eli +28 -0
  272. package/stdlib/managed-runtime-protocol.eli +28 -0
  273. package/stdlib/managed-runtime-queue.eli +9 -0
  274. package/stdlib/managed-runtime-record.eli +191 -0
  275. package/stdlib/managed-runtime-regex.eli +158 -0
  276. package/stdlib/managed-runtime-sequence.eli +305 -0
  277. package/stdlib/managed-runtime-set-algebra.eli +28 -0
  278. package/stdlib/managed-runtime-set.eli +9 -0
  279. package/stdlib/managed-runtime-sorted.eli +408 -0
  280. package/stdlib/managed-runtime-text.eli +14 -0
  281. package/stdlib/managed-runtime-transducer.eli +268 -0
  282. package/stdlib/managed-runtime-transient.eli +17 -0
  283. package/stdlib/managed-runtime-truth.eli +4 -0
  284. package/stdlib/managed-runtime-type.eli +232 -0
  285. package/stdlib/managed-runtime-value-internals.eli +13 -0
  286. package/stdlib/managed-runtime-value.eli +19 -0
  287. package/stdlib/managed-runtime-vector.eli +25 -0
  288. package/stdlib/managed-sorted-state.eli +233 -0
  289. package/stdlib/managed-testing-value.eli +6 -0
  290. package/stdlib/managed-transient-state.eli +348 -0
  291. package/stdlib/managed-value-state.eli +153 -0
  292. package/stdlib/managed-vector-view-state.eli +102 -0
  293. package/stdlib/managed-wire-http-rpc.eli +362 -0
  294. package/stdlib/managed-wire-markdown.eli +275 -0
  295. package/stdlib/managed-wire-schema.eli +193 -0
  296. package/stdlib/mdp.eli +7 -0
  297. package/stdlib/mds.eli +4 -0
  298. package/stdlib/persistent-vector.eli +23 -6
  299. package/tools/acceptance/check-legacy.mjs +687 -0
  300. package/tools/acceptance/check.eli +431 -0
  301. package/tools/acceptance/compile-evidence.el +49 -0
  302. package/tools/acceptance/finalize-legacy.mjs +498 -0
  303. package/tools/acceptance/finalize.eli +270 -0
  304. package/tools/backends/benchmark.mjs +175 -0
  305. package/tools/backends/build.mjs +135 -0
  306. package/tools/backends/compile.mjs +94 -0
  307. package/tools/backends/compiler-bootstrap.mjs +1001 -0
  308. package/tools/backends/compiler-browser.mjs +361 -0
  309. package/tools/backends/compiler-build.mjs +1628 -0
  310. package/tools/backends/compiler-cli-legacy.mjs +334 -0
  311. package/tools/backends/compiler-cli.mjs +29 -0
  312. package/tools/backends/compiler-corpus-bit.mjs +234 -0
  313. package/tools/backends/compiler-corpus-cli-adapters-legacy.mjs +362 -0
  314. package/tools/backends/compiler-corpus-cli-adapters.mjs +247 -0
  315. package/tools/backends/compiler-corpus-debugging.mjs +221 -0
  316. package/tools/backends/compiler-corpus-emitter.mjs +324 -0
  317. package/tools/backends/compiler-corpus-evaluation-adapters.mjs +65 -0
  318. package/tools/backends/compiler-corpus-execution-legacy.mjs +769 -0
  319. package/tools/backends/compiler-corpus-execution.mjs +3324 -0
  320. package/tools/backends/compiler-corpus-fuzz.mjs +229 -0
  321. package/tools/backends/compiler-corpus-generations.mjs +208 -0
  322. package/tools/backends/compiler-corpus-host-context-legacy.mjs +114 -0
  323. package/tools/backends/compiler-corpus-host-context.mjs +550 -0
  324. package/tools/backends/compiler-corpus-identity-host.mjs +553 -0
  325. package/tools/backends/compiler-corpus-identity-value-adapters-legacy.mjs +298 -0
  326. package/tools/backends/compiler-corpus-identity-value-adapters.mjs +69 -0
  327. package/tools/backends/compiler-corpus-isolated-exports.mjs +21 -0
  328. package/tools/backends/compiler-corpus-legacy.mjs +1155 -0
  329. package/tools/backends/compiler-corpus-literal-provider.mjs +282 -0
  330. package/tools/backends/compiler-corpus-managed-adapters-legacy.mjs +334 -0
  331. package/tools/backends/compiler-corpus-managed-adapters.mjs +937 -0
  332. package/tools/backends/compiler-corpus-managed-cases.mjs +179 -0
  333. package/tools/backends/compiler-corpus-managed-fixtures-legacy.mjs +879 -0
  334. package/tools/backends/compiler-corpus-managed-fixtures.mjs +1287 -0
  335. package/tools/backends/compiler-corpus-matchers.mjs +173 -0
  336. package/tools/backends/compiler-corpus-original-program.mjs +612 -0
  337. package/tools/backends/compiler-corpus-process.mjs +765 -0
  338. package/tools/backends/compiler-corpus-program-driver.mjs +306 -0
  339. package/tools/backends/compiler-corpus-project-adapters-legacy.mjs +497 -0
  340. package/tools/backends/compiler-corpus-project-adapters.mjs +340 -0
  341. package/tools/backends/compiler-corpus-project-entry-host.mjs +511 -0
  342. package/tools/backends/compiler-corpus-project-transport.mjs +151 -0
  343. package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1438 -0
  344. package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1456 -0
  345. package/tools/backends/compiler-corpus-raw-math-fixture.mjs +346 -0
  346. package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +523 -0
  347. package/tools/backends/compiler-corpus-reference-legacy.mjs +263 -0
  348. package/tools/backends/compiler-corpus-reference.mjs +241 -0
  349. package/tools/backends/compiler-corpus-runtime-adapters-legacy.mjs +843 -0
  350. package/tools/backends/compiler-corpus-runtime-adapters.mjs +663 -0
  351. package/tools/backends/compiler-corpus-source-archive.mjs +206 -0
  352. package/tools/backends/compiler-corpus-tools-artifact-adapters.mjs +410 -0
  353. package/tools/backends/compiler-corpus-tools-cli.mjs +363 -0
  354. package/tools/backends/compiler-corpus-tools-reference.mjs +264 -0
  355. package/tools/backends/compiler-corpus.mjs +2054 -0
  356. package/tools/backends/compiler-debug.mjs +142 -0
  357. package/tools/backends/compiler-matrix.mjs +1955 -0
  358. package/tools/backends/compiler-metadata.mjs +203 -0
  359. package/tools/backends/compiler-package-browser.mjs +120 -0
  360. package/tools/backends/compiler-package-legacy.mjs +654 -0
  361. package/tools/backends/compiler-package.mjs +464 -0
  362. package/tools/backends/compiler-project.mjs +126 -0
  363. package/tools/backends/compiler-session.mjs +843 -0
  364. package/tools/backends/compiler-sha256.mjs +152 -0
  365. package/tools/backends/compiler-unicode-profile-host.mjs +196 -0
  366. package/tools/backends/compiler-worker.mjs +573 -0
  367. package/tools/backends/dist/bootstrap-js-stages.mjs +919 -0
  368. package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -0
  369. package/tools/backends/dist/managed-ir-inventory.mjs +488 -0
  370. package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -0
  371. package/tools/backends/dist/record-grid.mjs +1256 -0
  372. package/tools/backends/dist/record-grid.mjs.map +1 -0
  373. package/tools/backends/dist/release-cli.mjs +462 -0
  374. package/tools/backends/dist/release-cli.mjs.map +1 -0
  375. package/tools/backends/dist/run-artifact.mjs +517 -0
  376. package/tools/backends/dist/run-artifact.mjs.map +1 -0
  377. package/tools/backends/eliscript/compiler-corpus-bit.eli +77 -0
  378. package/tools/backends/eliscript/compiler-corpus-debugging.eli +70 -0
  379. package/tools/backends/eliscript/compiler-corpus-project-entry-host.eli +256 -0
  380. package/tools/backends/managed-foreign-binding.mjs +497 -0
  381. package/tools/backends/managed-host-legacy.mjs +1181 -0
  382. package/tools/backends/managed-host-lifecycle.mjs +310 -0
  383. package/tools/backends/managed-host-object-provider.mjs +155 -0
  384. package/tools/backends/managed-host-object-realm.mjs +797 -0
  385. package/tools/backends/managed-host-proxy.mjs +71 -0
  386. package/tools/backends/managed-host-runtime.mjs +5868 -0
  387. package/tools/backends/managed-host.mjs +716 -0
  388. package/tools/backends/managed-module-graph-legacy.mjs +308 -0
  389. package/tools/backends/managed-module-graph.mjs +694 -0
  390. package/tools/backends/managed-runtime-host-legacy.mjs +195 -0
  391. package/tools/backends/managed-runtime.mjs +939 -0
  392. package/tools/backends/managed-source-view-legacy.mjs +332 -0
  393. package/tools/backends/managed-source-view.mjs +959 -0
  394. package/tools/backends/memory-runtime.mjs +100 -0
  395. package/tools/backends/native-benchmark.mjs +88 -0
  396. package/tools/backends/native-managed-runtime.mjs +677 -0
  397. package/tools/backends/native-memory.mjs +768 -0
  398. package/tools/backends/native-node-memory.mjs +142 -0
  399. package/tools/backends/native-node-runner.mjs +99 -0
  400. package/tools/backends/native-node-watchdog.mjs +19 -0
  401. package/tools/backends/native-node-worker.mjs +75 -0
  402. package/tools/backends/stage3-targets.mjs +493 -0
  403. package/tools/bootstrap-command.el +13 -0
  404. package/tools/bootstrap-runtime.el +101 -0
  405. package/tools/bootstrap-seed.el +55 -0
  406. package/tools/project/check-cli.eli +31 -0
  407. package/tools/project/project-cli.eli +42 -0
  408. package/tools/project/project.eli +122 -0
  409. package/tools/runtime/unicode-case-profiles.mjs +13 -0
  410. package/tools/runtime/unicode-case-runtime.el +57 -0
  411. package/tools/testing/source-debugging-corpus-host.eli +16 -0
  412. package/tools/testing/source-debugging.eli +139 -0
  413. package/tools/testing/stdlib-bit-corpus-host.eli +21 -0
  414. package/tools/testing/stdlib-bit-corpus-host.mjs +118 -0
  415. package/tools/testing/stdlib-bit.eli +104 -0
  416. package/tools/testing/stdlib-bit.mjs +255 -0
  417. package/bin/eliscript-bootstrap +0 -15
@@ -0,0 +1,77 @@
1
+ (module tools.backends.compiler-corpus-bit
2
+ (import "node:crypto" createHash)
3
+ (import "node:buffer" Buffer)
4
+ (import "./build.mjs" root)
5
+ (import "./compiler-corpus-legacy.mjs" createOriginalCorpusSourceReader)
6
+ (defconst id "original-program:compiler-stdlib-bit-complete")
7
+ (defconst suite "tests/stdlib-bit.test.mjs")
8
+ (defconst suite-sha "c550405d71455b5ce694c929b63b6a0843ea637f5b35ccf221afd5780ce16771")
9
+ (defconst files (js-array
10
+ "tools/backends/eliscript/compiler-corpus-bit.eli" "tools/backends/compiler-corpus-bit.mjs"
11
+ "tests/stdlib-bit.test.mjs" "tests/eliscript/stdlib-bit.eli" "tests/stdlib-bit-selfhosted.test.mjs"
12
+ "tools/testing/stdlib-bit.eli" "tools/testing/stdlib-bit.mjs"
13
+ "tools/testing/stdlib-bit-corpus-host.eli" "tools/testing/stdlib-bit-corpus-host.mjs"
14
+ "tests/helpers/seed-compiler.mjs" "tools/backends/build.mjs" "package.json"
15
+ "stdlib/bit.eli" "tests/fixtures/bit-usage.eli" "tests/fixtures/bit-host.mjs"
16
+ "runtime/math.eli" "runtime/math.mjs" "runtime/math.mjs.map"
17
+ "runtime/unicode-case.eli" "runtime/unicode-case.mjs" "runtime/unicode-case.mjs.map"
18
+ "runtime/unicode-case-data.eli" "runtime/unicode-case-data.mjs" "runtime/unicode-case-data.mjs.map"))
19
+ (defun hash (value) (js-call (js-call (createHash "sha256") :update value) :digest "hex"))
20
+ (defun fail (message) (throw (new globalThis.TypeError message)))
21
+ (defasync transportOriginalStdlibBitCorpus (document options)
22
+ (let ((records (js-call (get document :records) :filter (lambda (record) (= (get record :id) id)))))
23
+ (when (> (js-length records) 0)
24
+ (unless (= (js-length records) 1) (fail "original complete bit record must be unique"))
25
+ (let* ((record (aref records 0)) (original (get record :original)) (execution (get record :execution))
26
+ (reader (createOriginalCorpusSourceReader (js-object :sourceRoot (get options :sourceRoot root))))
27
+ (source (await (js-call reader :text suite))) (proofs (js-array)) (index 0))
28
+ (unless (and (= (hash source) suite-sha) (= (get original :sourceSha256) suite-sha)
29
+ (= (get original :suite) suite) (= (get original :fixture) suite) (= (get original :host) suite)
30
+ (= (get execution :kind) "original-program") (= (get execution :timeoutMs) 30000)
31
+ (= (get execution :requiresBun) t) (= (get execution :hostRuntime) "bun")
32
+ (= (get execution :referenceArtifact) t)
33
+ (= (get execution :host) "tests/__eliscript_original_stdlib-bit_complete.mjs")
34
+ (= (get (get execution :setupReplacement) :kind) "selected-and-independent-reference-compiler-directories")
35
+ (= (JSON/stringify (get (get execution :setupReplacement) :originalCaseTimeouts)) "[30000]"))
36
+ (fail "original complete bit source identity or execution contract changed"))
37
+ (unless (and (Array/isArray (get original :regions)) (= (js-length (get original :regions)) 1))
38
+ (fail "original complete bit assertion region changed"))
39
+ (let ((region (aref (get original :regions) 0)))
40
+ (unless (and (= (get region :start) 0) (= (get region :end) (js-length source))
41
+ (= (get region :byteStart) 0) (= (get region :byteEnd) (js-call Buffer :byteLength source))
42
+ (= (get region :sha256) suite-sha))
43
+ (fail "original complete bit assertion region changed")))
44
+ (while (< index (js-length files))
45
+ (let* ((filename (aref files index)) (asset (await (js-call reader :file filename)))
46
+ (previous (js-call (get document :evidence) :find (lambda (item) (= (get item :file) filename)))))
47
+ (when previous
48
+ (unless (and (= (get previous :sha256) (get asset :sha256)) (= (get previous :bytes) (get asset :bytes))
49
+ (= (get previous :encoding) (get asset :encoding)) (= (get previous :content) (get asset :content)))
50
+ (fail (str "original complete bit asset identity changed: " filename))))
51
+ (unless previous (js-call (get document :evidence) :push asset))
52
+ (js-call proofs :push (js-object :file filename :sourceSha256 (get asset :sha256))))
53
+ (setq index (1+ index)))
54
+ (let* ((host-file "tools/testing/stdlib-bit-corpus-host.mjs") (host (await (js-call reader :text host-file)))
55
+ (assets (js-call (get original :sourceAssets (js-array)) :slice)))
56
+ (js-call proofs :forEach (lambda (proof)
57
+ (let ((previous (js-call assets :find (lambda (item) (= (get item :file) (get proof :file))))))
58
+ (when (and previous (/= (get previous :sourceSha256) (get proof :sourceSha256)))
59
+ (fail "original complete bit maintained proof changed"))
60
+ (unless previous (js-call assets :push proof)))))
61
+ (let ((forwarded (Object/assign (js-object) execution (js-object :host host-file))))
62
+ (Reflect/deleteProperty forwarded "hostSource")
63
+ (put record :execution forwarded))
64
+ (put record :original (Object/assign (js-object) original
65
+ (js-object :sourceAssets assets
66
+ :assertionSource (js-object :file suite :sourceSha256 suite-sha :regions (get original :regions))
67
+ :maintainedAssertions (js-object :sourceFile "tools/testing/stdlib-bit.eli"
68
+ :sourceSha256 (get (js-call proofs :find (lambda (proof) (= (get proof :file) "tools/testing/stdlib-bit.eli"))) :sourceSha256)
69
+ :generatedFile "tools/testing/stdlib-bit.mjs"
70
+ :generatedSha256 (get (js-call proofs :find (lambda (proof) (= (get proof :file) "tools/testing/stdlib-bit.mjs"))) :sourceSha256))
71
+ :maintainedTransport
72
+ (js-object :kind "maintained-eli-complete-stdlib-bit" :version 1 :logicalSuite suite
73
+ :originalSourceSha256 suite-sha :sourceFile "tools/testing/stdlib-bit-corpus-host.eli"
74
+ :generatedFile host-file :generatedSha256 (hash host) :originalTimeoutMs 30000
75
+ :hosts (js-array "bun" "node") :compilerCount 2 :hostExecutions 4 :fallback false)))))))
76
+ document))
77
+ (export transportOriginalStdlibBitCorpus))
@@ -0,0 +1,70 @@
1
+ (module tools.backends.compiler-corpus-debugging
2
+ (import "node:crypto" createHash)
3
+ (import "node:buffer" Buffer)
4
+ (import "./build.mjs" root)
5
+ (import "./compiler-corpus-legacy.mjs" createOriginalCorpusSourceReader)
6
+ (defconst id "original-program:compiler-source-debugging")
7
+ (defconst suite "tests/source-debugging.test.mjs")
8
+ (defconst suite-sha "8eb14ca45564e54d1874bd04a791f1d5ca89cfff72a4c0f07c82b2d00dee8ca7")
9
+ (defconst files (js-array suite
10
+ "tools/backends/eliscript/compiler-corpus-debugging.eli" "tools/backends/compiler-corpus-debugging.mjs"
11
+ "tests/eliscript/source-debugging.eli" "tests/source-debugging-selfhosted.test.mjs"
12
+ "tools/testing/source-debugging.eli" "tools/testing/source-debugging.mjs"
13
+ "tools/testing/source-debugging-corpus-host.eli" "tools/testing/source-debugging-corpus-host.mjs"
14
+ "tools/testing/fixture-environment.eli" "tools/testing/fixture-environment.mjs" "package.json"))
15
+ (defun hash (value) (js-call (js-call (createHash "sha256") :update value) :digest "hex"))
16
+ (defun fail (message) (throw (new globalThis.TypeError message)))
17
+ (defasync transportOriginalSourceDebuggingCorpus (document options)
18
+ (let ((records (js-call (get document :records) :filter (lambda (record) (= (get record :id) id)))))
19
+ (when (> (js-length records) 0)
20
+ (unless (= (js-length records) 1) (fail "original source debugging record must be unique"))
21
+ (let* ((record (aref records 0)) (original (get record :original)) (execution (get record :execution))
22
+ (reader (createOriginalCorpusSourceReader (js-object :sourceRoot (get options :sourceRoot root))))
23
+ (source (await (js-call reader :text suite))) (proofs (js-array)) (index 0))
24
+ (unless (and (= (hash source) suite-sha) (= (get original :sourceSha256) suite-sha)
25
+ (= (get original :suite) suite) (= (get execution :kind) "original-program")
26
+ (= (get execution :timeoutMs) 30000) (= (get execution :requiresBun) t)
27
+ (= (get execution :runtimeLaunchers) t) (= (get execution :compilerSourceMaps) t)
28
+ (= (JSON/stringify (get (get execution :setupReplacement) :originalCaseTimeouts)) "[5000,5000,5000,5000,5000]"))
29
+ (fail "original source debugging source identity or execution contract changed"))
30
+ (unless (and (= (js-length (get original :regions)) 1)
31
+ (= (get (aref (get original :regions) 0) :start) 0)
32
+ (= (get (aref (get original :regions) 0) :end) (js-length source))
33
+ (= (get (aref (get original :regions) 0) :byteStart) 0)
34
+ (= (get (aref (get original :regions) 0) :byteEnd) (js-call Buffer :byteLength source))
35
+ (= (get (aref (get original :regions) 0) :sha256) suite-sha))
36
+ (fail "original source debugging complete assertion span changed"))
37
+ (while (< index (js-length files))
38
+ (let* ((filename (aref files index)) (asset (await (js-call reader :file filename)))
39
+ (previous (js-call (get document :evidence) :find (lambda (item) (= (get item :file) filename)))))
40
+ (when previous
41
+ (unless (and (= (get previous :sha256) (get asset :sha256)) (= (get previous :bytes) (get asset :bytes))
42
+ (= (get previous :encoding) (get asset :encoding)) (= (get previous :content) (get asset :content)))
43
+ (fail (str "original source debugging asset identity changed: " filename))))
44
+ (unless previous (js-call (get document :evidence) :push asset))
45
+ (js-call proofs :push (js-object :file filename :sourceSha256 (get asset :sha256))))
46
+ (setq index (1+ index)))
47
+ (let* ((host-file "tools/testing/source-debugging-corpus-host.mjs")
48
+ (host (await (js-call reader :text host-file)))
49
+ (assets (js-call (get original :sourceAssets) :slice))
50
+ (updated (Object/assign (js-object) execution (js-object :host host-file))))
51
+ (js-call proofs :forEach (lambda (proof)
52
+ (let ((previous (js-call assets :find (lambda (item) (= (get item :file) (get proof :file))))))
53
+ (when (and previous (/= (get previous :sourceSha256) (get proof :sourceSha256)))
54
+ (fail "original source debugging maintained proof changed"))
55
+ (unless previous (js-call assets :push proof)))))
56
+ (Reflect/deleteProperty updated "hostSource")
57
+ (put record :execution updated)
58
+ (put record :original (Object/assign (js-object) original (js-object :sourceAssets assets
59
+ :assertionSource (js-object :file suite :sourceSha256 suite-sha :regions (get original :regions))
60
+ :maintainedAssertions (js-object :sourceFile "tools/testing/source-debugging.eli"
61
+ :sourceSha256 (get (js-call proofs :find (lambda (proof) (= (get proof :file) "tools/testing/source-debugging.eli"))) :sourceSha256)
62
+ :generatedFile "tools/testing/source-debugging.mjs"
63
+ :generatedSha256 (get (js-call proofs :find (lambda (proof) (= (get proof :file) "tools/testing/source-debugging.mjs"))) :sourceSha256))
64
+ :maintainedTransport (js-object :kind "maintained-eli-complete-source-debugging" :version 1 :logicalSuite suite
65
+ :originalSourceSha256 suite-sha :sourceFile "tools/testing/source-debugging-corpus-host.eli"
66
+ :generatedFile host-file :generatedSha256 (hash host) :originalTimeoutMs 30000
67
+ :originalCaseTimeouts (js-array 5000 5000 5000 5000 5000)
68
+ :hosts (js-array "bun" "node") :fallback false)))))))
69
+ document))
70
+ (export transportOriginalSourceDebuggingCorpus))
@@ -0,0 +1,256 @@
1
+ (module tools.backends.compiler-corpus-project-entry-host
2
+ (import "./compiler-corpus-process.mjs" readOriginalCorpusExecutionContext)
3
+ (import "node:assert/strict" :default assert)
4
+ (import "node:path" resolve basename)
5
+ (import "node:url" pathToFileURL)
6
+ (import "node:module" createRequire)
7
+ (import "node:fs/promises" realpath readFile writeFile mkdir)
8
+
9
+ (defasync loadProjectEntryNamespace (path id loader)
10
+ ;; These emitted fixture and IO modules have no top-level await. Supply
11
+ ;; their actual namespace using the loader's existing second argument;
12
+ ;; do not ask Bun's async file wrapper to manufacture a namespace export.
13
+ (let ((canonical path))
14
+ (try (setq canonical (await (realpath path)))
15
+ (catch error (unless (= (get error :code) "ENOENT") (throw error))))
16
+ (let* ((namespace (funcall (createRequire canonical) canonical))
17
+ (loaded (await (js-call loader :loadManagedHostModules
18
+ (js-object :hostModules (js-array (js-object :id id
19
+ :specifier (get (pathToFileURL canonical) :href) :referrer "project-entry-host.mjs"
20
+ :allowedExports (js-array) :namespace t)))
21
+ (js-object :hostModules (new globalThis.Map (js-array (js-array id namespace))))))))
22
+ (js-call assert :strictEqual (get namespace globalThis.Symbol.toStringTag) "Module")
23
+ (js-call assert :strictEqual (js-call loaded :get id) namespace)
24
+ namespace)))
25
+
26
+ ;; This is the project-entry observation from the original managed fixture
27
+ ;; adapter. Functions belong to their own independently instantiated graph;
28
+ ;; only the resulting data is compared between the two products.
29
+ (defun observeProjectEntry (module)
30
+ (js-call assert :strictEqual (get (get module :api) :history) (get module :history))
31
+ (js-call assert :strictEqual (get (get module :api) :identity) (get module :identity))
32
+ (js-call assert :strictEqual (get (get module :initial) :self) (get module :initial))
33
+ (let ((reader (js-call module :read)))
34
+ (js-call assert :strictEqual reader (get (get module :api) :read_counter))
35
+ (js-call assert :strictEqual (funcall reader) (get module :counter))
36
+ (let ((initial (js-array (get module :counter) (js-call module :current) (funcall reader)
37
+ (js-call (get module :history) :slice) (js-call (get module :order) :slice)
38
+ (js-call module :alias 99)))
39
+ (deltas (js-array 4 -0 -1 2)) (index 0))
40
+ (while (< index (js-length deltas))
41
+ (js-call module :increment (aref deltas index))
42
+ (js-call assert :strictEqual (get module :counter) (js-call module :current))
43
+ (js-call assert :strictEqual (js-call module :read) reader)
44
+ (js-call assert :strictEqual (funcall reader) (get module :counter))
45
+ (setq index (1+ index)))
46
+ (let* ((snapshot (js-call module :snapshot))
47
+ (names (js-call module :names)) (failed false) (failure undefined))
48
+ (js-call assert :strictEqual (get snapshot :extra) 7)
49
+ (js-call assert :strictEqual (get snapshot :history) (get module :history))
50
+ (try (js-call module :forbidden)
51
+ (catch error (setq failed t failure error)))
52
+ (js-call assert :strictEqual failed t "the original namespace assignment must fail")
53
+ (js-array initial (get module :counter) (js-call (get module :history) :slice)
54
+ names (get failure :name) (get (get module :initial) :values)
55
+ (get (get module :initial) :label))))))
56
+
57
+ (defasync main ()
58
+ (let* ((env (get globalThis.process :env)) (argv (get globalThis.process :argv))
59
+ (root (get env :ELISCRIPT_ORIGINAL_SOURCE_ROOT))
60
+ (reference (get env :ELISCRIPT_ORIGINAL_REFERENCE_PRODUCT_ROOT))
61
+ (product (aref argv 2)) (entry (aref argv 3)) (runtime undefined) (observations 0))
62
+ (unless (and root reference)
63
+ (throw (new globalThis.Error "original fixture execution requires its independent Seed product")))
64
+ (let* ((loader-path (resolve root "tools/backends/managed-runtime.mjs"))
65
+ (loader (funcall (createRequire loader-path) loader-path)))
66
+ (letfn ((load (path id)
67
+ (async ()
68
+ (await (loadProjectEntryNamespace path id loader)))))
69
+ (let* ((selected (await (funcall (load (resolve product entry) "selected-project"))))
70
+ (oracle (await (funcall (load (resolve reference entry) "reference-project")))))
71
+ (unless (= (get env :ELISCRIPT_ORIGINAL_TARGET) "javascript")
72
+ (let ((configuration (get env :ELISCRIPT_ORIGINAL_PROGRAM_CONTEXT)))
73
+ (unless configuration
74
+ (throw (new globalThis.Error "selected binary fixture requires its real runtime context")))
75
+ (let* ((metadata (await (funcall (load (resolve root "tools/backends/compiler-metadata.mjs") "metadata"))))
76
+ (input (await (js-call metadata :readCompilerMetadata configuration)))
77
+ (context (await (funcall (load (resolve root "tools/backends/compiler-corpus-host-context.mjs") "context"))))
78
+ (opened (await (js-call context :openOriginalProgramContext input (js-object :identity configuration)))))
79
+ (setq runtime (get opened :runtime))
80
+ (js-call runtime :auto 1))))
81
+ ;; As in the original compare(), the Seed observation runs first.
82
+ (let* ((expected (observeProjectEntry oracle)) (actual (observeProjectEntry selected)))
83
+ (js-call assert :deepStrictEqual actual expected "linked defaults namespaces and live bindings")
84
+ (setq observations (1+ observations))
85
+ (when runtime
86
+ (js-call runtime :collect)
87
+ (js-call assert :strictEqual (get (js-call runtime :stats) :frameDepth) 0
88
+ "linked defaults namespaces and live bindings restores private frames")
89
+ (js-call runtime :closeModule) (js-call runtime :collect)
90
+ (js-call assert :strictEqual (js-call runtime :live) 0)
91
+ (js-call assert :strictEqual (get (js-call runtime :stats) :frameDepth) 0))
92
+ (js-call assert :ok (> observations 0) "a fixture must execute assertions, not merely compile")
93
+ (js-call globalThis.console :log (JSON/stringify (js-object :observations observations)))))))))
94
+ (defun observeStandardIdentities (module data-text order protocol)
95
+ (let* ((IPrint (get data-text :IPrint)) (IComparable (get order :IComparable))
96
+ (input (js-object)))
97
+ (Object/defineProperty input (js-call protocol :protocolSlot IPrint "print")
98
+ (js-object :value (lambda () "host-print") :writable t :enumerable t :configurable t))
99
+ (Object/defineProperty input (js-call protocol :protocolSlot IComparable "compare")
100
+ (js-object :value (lambda () 0) :writable t :enumerable t :configurable t))
101
+ (js-call assert :deepStrictEqual (Array/from (js-call module :read_standard_input input)) (js-array "host-print" 0))
102
+ (let ((values (js-call module :standard_protocol_identities)))
103
+ (js-call assert :strictEqual (aref values 0) (js-call protocol :protocolSlot IPrint "print"))
104
+ (js-call assert :strictEqual (aref values 1) (js-call protocol :protocolMethod IPrint "print"))
105
+ (js-call assert :strictEqual (aref values 2) (get IPrint :operations))
106
+ (js-call assert :strictEqual (aref values 3) IPrint)
107
+ (js-call assert :strictEqual (aref values 4) (js-call protocol :protocolSlot IComparable "compare"))
108
+ (js-call assert :strictEqual (aref values 5) IComparable)
109
+ (js-call assert :strictEqual (js-call data-text :printValue (aref values 6)) "target-print")
110
+ (js-call assert :strictEqual (js-call order :compareValues (aref values 6) (aref values 6)) 0)
111
+ (js-call assert :strictEqual (js-call protocol :isProtocol (aref values 7)) t)
112
+ (js-call assert :notStrictEqual (aref values 7) IPrint)
113
+ (js-call assert :notStrictEqual (js-call protocol :protocolSlot (aref values 7) "print")
114
+ (js-call protocol :protocolSlot IPrint "print")))))
115
+ (defasync standard-main ()
116
+ (let* ((env (get globalThis.process :env)) (argv (get globalThis.process :argv))
117
+ (root (get env :ELISCRIPT_ORIGINAL_SOURCE_ROOT))
118
+ (reference (get env :ELISCRIPT_ORIGINAL_REFERENCE_PRODUCT_ROOT))
119
+ ;; JavaScript products retain a private package self-scope. Their
120
+ ;; observer must use that same graph's protocol slots and methods.
121
+ ;; Binary products use the authenticated host capability boundary.
122
+ (protocol-root (if (= (get env :ELISCRIPT_ORIGINAL_TARGET) "javascript")
123
+ (aref argv 2) root)))
124
+ (unless (and root reference)
125
+ (throw (new globalThis.Error "complete original managed corpus requires its independent Seed source graph")))
126
+ (let* ((loader-path (resolve root "tools/backends/managed-runtime.mjs"))
127
+ (loader (funcall (createRequire loader-path) loader-path))
128
+ (module (await (loadProjectEntryNamespace (resolve (aref argv 2) (aref argv 3)) "selected" loader))))
129
+ (unless (= (get env :ELISCRIPT_ORIGINAL_TARGET) "javascript")
130
+ (let* ((configuration (get env :ELISCRIPT_ORIGINAL_PROGRAM_CONTEXT)))
131
+ (unless configuration
132
+ (throw (new globalThis.Error "selected binary original corpus requires its actual runtime context")))
133
+ (let* ((metadata (await (loadProjectEntryNamespace (resolve root "tools/backends/compiler-metadata.mjs") "metadata" loader)))
134
+ (input (await (js-call metadata :readCompilerMetadata configuration)))
135
+ (context (await (loadProjectEntryNamespace (resolve root "tools/backends/compiler-corpus-host-context.mjs") "context" loader))))
136
+ (await (js-call context :openOriginalProgramContext input (js-object :identity configuration))))))
137
+ (observeStandardIdentities module
138
+ (await (loadProjectEntryNamespace (resolve protocol-root "runtime/core/data-text.mjs") "data-text" loader))
139
+ (await (loadProjectEntryNamespace (resolve protocol-root "runtime/core/order.mjs") "order" loader))
140
+ (await (loadProjectEntryNamespace (resolve protocol-root "runtime/core/protocol.mjs") "protocol" loader)))
141
+ (js-call globalThis.console :log "standard identities preserved"))))
142
+ (defun functionPropertiesExpectedShape (target mode shape)
143
+ (unless (js-call (js-array "javascript" "wasm" "native") :includes target)
144
+ (throw (new globalThis.TypeError "unknown original function-properties target")))
145
+ (if (and (/= target "javascript") (= mode 3))
146
+ "[[],[\"length\",\"name\",\"prototype\"],[],true,[\"function\",\"\",0,false,true]]" shape))
147
+ (defun observeFunctionProperties (module keys)
148
+ (let ((out (js-array)) (mode 0) (index 0))
149
+ (while (< mode 6)
150
+ (setq index 0)
151
+ (while (< index (js-length keys))
152
+ (js-call out :push (js-call module :reflection_snapshot mode (aref keys index)))
153
+ (setq index (1+ index)))
154
+ (setq mode (1+ mode)))
155
+ (setq mode 0)
156
+ (while (< mode 6)
157
+ (js-call out :push (js-call module :reflection_shape mode)) (setq mode (1+ mode)))
158
+ (setq mode 0)
159
+ (while (< mode 3)
160
+ (js-call out :push (js-call module :reflection_effects mode)) (setq mode (1+ mode)))
161
+ (setq index 0)
162
+ (while (< index 4)
163
+ (js-call out :push (js-array (js-call module :cached) (js-call module :call_number "12")
164
+ (js-call module :call_string 2) (js-call module :call_finite 2) (js-call module :static_finite 2)
165
+ (js-call module :call_symbol) (js-call module :call_error) (js-call module :effects)))
166
+ (setq index (1+ index))) out))
167
+ (defasync runOriginalFunctionPropertiesHost (keys)
168
+ (let* ((env (get globalThis.process :env)) (argv (get globalThis.process :argv))
169
+ (root (get env :ELISCRIPT_ORIGINAL_SOURCE_ROOT))
170
+ (target (get env :ELISCRIPT_ORIGINAL_TARGET "javascript"))
171
+ (reference (get env :ELISCRIPT_ORIGINAL_REFERENCE_PRODUCT_ROOT))
172
+ (loader-path (resolve root "tools/backends/managed-runtime.mjs"))
173
+ (loader (funcall (createRequire loader-path) loader-path))
174
+ (selected (await (loadProjectEntryNamespace (resolve (aref argv 2) (aref argv 3)) "selected" loader)))
175
+ (runtime undefined) (expected undefined))
176
+ (if (= target "javascript")
177
+ (setq expected (observeFunctionProperties
178
+ (await (loadProjectEntryNamespace (resolve reference (aref argv 3)) "reference" loader)) keys))
179
+ (let* ((configuration (get env :ELISCRIPT_ORIGINAL_PROGRAM_CONTEXT))
180
+ (metadata (await (loadProjectEntryNamespace (resolve root "tools/backends/compiler-metadata.mjs") "metadata" loader)))
181
+ (input (await (js-call metadata :readCompilerMetadata configuration)))
182
+ (context (await (loadProjectEntryNamespace (resolve root "tools/backends/compiler-corpus-host-context.mjs") "context" loader)))
183
+ (opened (await (js-call context :openOriginalProgramContext input (js-object :identity configuration))))
184
+ (compiler (await (loadProjectEntryNamespace (resolve root "dist/bootstrap/compiler.mjs") "compiler" loader)))
185
+ (transport (await (loadProjectEntryNamespace (resolve root "tools/backends/compiler-corpus-managed-adapters.mjs") "transport" loader)))
186
+ (execution (readOriginalCorpusExecutionContext (get env :ELISCRIPT_ORIGINAL_EXECUTION_CONTEXT)))
187
+ (source (str "(import " (JSON/stringify (get (pathToFileURL (resolve root "tools/backends/compiler-corpus-project-entry-host.mjs")) :href)) " observeFunctionProperties)\n"
188
+ "(import " (JSON/stringify (get (pathToFileURL (resolve reference (aref argv 3))) :href)) " :as fixture)\n"
189
+ "(js-call globalThis.console :log (JSON/stringify (observeFunctionProperties fixture (JSON/parse "
190
+ (JSON/stringify (JSON/stringify keys)) "))))")))
191
+ (setq runtime (get opened :runtime))
192
+ (js-call runtime :auto 1)
193
+ (setq expected (await (js-call transport :runOriginalManagedObservation
194
+ (js-object :source (js-call compiler :compile_string source "original-function-properties-reference.eli")
195
+ :sourceRoot root :engine "node" :selected false :environment env
196
+ :args (js-array "original-function-properties-reference") :timeoutMs 30000)
197
+ (Object/assign (js-object) execution (js-object :directory (resolve (get execution :directory) "function-properties-node-reference"))))))
198
+ (let ((offset (* 6 (js-length keys))))
199
+ (put expected (+ offset 3) (functionPropertiesExpectedShape target 3 (aref expected (+ offset 3)))))))
200
+ (let ((actual (observeFunctionProperties selected keys)))
201
+ (js-call assert :deepStrictEqual actual expected "complete original function properties observations")
202
+ (when runtime
203
+ (js-call runtime :collect)
204
+ (js-call assert :strictEqual (get (js-call runtime :stats) :frameDepth) 0)
205
+ (js-call runtime :closeModule) (js-call runtime :collect)
206
+ (js-call assert :strictEqual (js-call runtime :live) 0))
207
+ (js-call globalThis.console :log (JSON/stringify (js-object :observations (js-length actual)))))))
208
+ (defasync runOriginalRawFixtureMain (configuration-input)
209
+ (let* ((family (get configuration-input :family))
210
+ (module-file (get configuration-input :helper))
211
+ (entry-name (get configuration-input :export))
212
+ (env (get globalThis.process :env)) (argv (get globalThis.process :argv))
213
+ (root (get env :ELISCRIPT_ORIGINAL_SOURCE_ROOT))
214
+ (loader-path (resolve root "tools/backends/managed-runtime.mjs"))
215
+ (loader (funcall (createRequire loader-path) loader-path))
216
+ (configuration (get env :ELISCRIPT_ORIGINAL_PROGRAM_CONTEXT))
217
+ (metadata (await (loadProjectEntryNamespace (resolve root "tools/backends/compiler-metadata.mjs") "metadata" loader)))
218
+ (input (await (js-call metadata :readCompilerMetadata configuration)))
219
+ (context (await (loadProjectEntryNamespace (resolve root "tools/backends/compiler-corpus-host-context.mjs") "context" loader)))
220
+ (opened (await (js-call context :openOriginalProgramContext input (js-object :identity configuration))))
221
+ (helper (await (loadProjectEntryNamespace (resolve root module-file) "raw-observer" loader)))
222
+ (oracle (await (loadProjectEntryNamespace (resolve (get env :ELISCRIPT_ORIGINAL_REFERENCE_PRODUCT_ROOT) (aref argv 3)) "reference" loader)))
223
+ (runtime (get opened :runtime)))
224
+ (js-call runtime :auto (get configuration-input :auto 1))
225
+ (let* ((execution (readOriginalCorpusExecutionContext (get env :ELISCRIPT_ORIGINAL_EXECUTION_CONTEXT)))
226
+ (source (if (get configuration-input :suite) (await (readFile (resolve root (get configuration-input :suite)) "utf8")) undefined))
227
+ (result (funcall (get helper entry-name) (js-object :family family :runtime runtime :oracle oracle
228
+ :source source :sourceSha256 (get configuration-input :sourceSha256)))))
229
+ (js-call runtime :closeModule) (js-call runtime :collect)
230
+ (js-call assert :strictEqual (js-call runtime :live) 0)
231
+ (js-call assert :strictEqual (get (js-call runtime :stats) :frameDepth) 0)
232
+ (await (mkdir (get execution :directory) (js-object :recursive t)))
233
+ (await (writeFile (resolve (get execution :directory) "original-fixture-observations.json")
234
+ (JSON/stringify (Object/assign (js-object) result (js-object :version 1 :family family
235
+ :target (get execution :target) :sourceIdentity (get execution :sourceIdentity)
236
+ :originalHostSha256 (get configuration-input :originalHostSha256) :observationContract "original-raw-suite")))))
237
+ (js-call globalThis.console :log (JSON/stringify (js-object :observations (get result :observations)))))))
238
+ (defasync run-selected-entry ()
239
+ (let ((path (aref (get globalThis.process :argv) 1)))
240
+ (when (= (value-type path) "string")
241
+ (cond
242
+ ((js-call (basename path) :startsWith "__eliscript_managed_fixture_project-entry_") (await (main)))
243
+ ((js-call (basename path) :startsWith "__eliscript_managed_sequence-data-standard-identities_") (await (standard-main)))))))
244
+ (defconst entry-completion (run-selected-entry))
245
+ (js-call entry-completion :catch (lambda (error)
246
+ (try (js-call (get globalThis.process :stderr) :write (str (funcall globalThis.String error) "\n"))
247
+ (catch ignored nil))
248
+ (put globalThis.process :exitCode 1)))
249
+ (defun then (fulfill reject)
250
+ (js-call entry-completion :then (lambda (ignored)
251
+ (funcall fulfill (Object/freeze (js-object
252
+ :observeProjectEntry observeProjectEntry :loadProjectEntryNamespace loadProjectEntryNamespace
253
+ :observeStandardIdentities observeStandardIdentities :functionPropertiesExpectedShape functionPropertiesExpectedShape
254
+ :observeFunctionProperties observeFunctionProperties :runOriginalFunctionPropertiesHost runOriginalFunctionPropertiesHost
255
+ :runOriginalRawFixtureMain runOriginalRawFixtureMain)))) reject))
256
+ (export observeProjectEntry loadProjectEntryNamespace observeStandardIdentities functionPropertiesExpectedShape observeFunctionProperties runOriginalFunctionPropertiesHost runOriginalRawFixtureMain then))