eliscript 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/bootstrap/README.md +26 -0
- package/bootstrap/backends/README.md +515 -0
- package/bootstrap/backends/async.eli +230 -0
- package/bootstrap/backends/binary.eli +173 -0
- package/bootstrap/backends/capabilities.eli +74 -0
- package/bootstrap/backends/elf.eli +246 -0
- package/bootstrap/backends/managed.eli +5976 -0
- package/bootstrap/backends/memory.eli +100 -0
- package/bootstrap/backends/native.eli +2000 -0
- package/bootstrap/backends/numeric.eli +1362 -0
- package/bootstrap/backends/optimize.eli +79 -0
- package/bootstrap/backends/regexp.eli +2263 -0
- package/bootstrap/backends/sha256.eli +138 -0
- package/bootstrap/backends/wasm.eli +1161 -0
- package/bootstrap/compiler/analyzer.eli +165 -77
- package/bootstrap/compiler/compiler.eli +43 -19
- package/bootstrap/compiler/emitter.eli +780 -170
- package/bootstrap/compiler/expander.eli +136 -45
- package/bootstrap/compiler/formatter.eli +8 -1
- package/bootstrap/compiler/ir.eli +148 -45
- package/bootstrap/compiler/lower.eli +29 -2
- package/bootstrap/compiler/project.eli +51 -21
- package/bootstrap/compiler/reader.eli +128 -36
- package/bootstrap/compiler/source-map.eli +46 -4
- package/bootstrap/compiler/symbol.eli +2 -1
- package/bootstrap/compiler/syntax.eli +47 -12
- package/bootstrap/compiler/transient-analysis.eli +40 -4
- package/bootstrap/host/check-cli-legacy.mjs +163 -0
- package/bootstrap/host/check-cli.mjs +59 -158
- package/bootstrap/host/check-cli.mjs.map +1 -0
- package/bootstrap/host/compiler-session.eli +1579 -0
- package/bootstrap/host/compiler-tools.eli +513 -0
- package/bootstrap/host/eliscript-cli-legacy.mjs +37 -0
- package/bootstrap/host/eliscript-cli.mjs +53 -33
- package/bootstrap/host/eliscript-cli.mjs.map +1 -0
- package/bootstrap/host/project-cli-legacy.mjs +295 -0
- package/bootstrap/host/project-cli.mjs +74 -289
- package/bootstrap/host/project-cli.mjs.map +1 -0
- package/bootstrap/host/project-legacy.mjs +1080 -0
- package/bootstrap/host/project.mjs +210 -1060
- package/bootstrap/host/project.mjs.map +1 -0
- package/bootstrap/runtime/UNICODE-LICENSE.txt +39 -0
- package/bootstrap/runtime/memory.eli +30379 -0
- package/browser/host.mjs +89 -0
- package/compiler/eliscript-analyzer.el +371 -4
- package/compiler/eliscript-cli.el +84 -1
- package/compiler/eliscript-emitter.el +1189 -256
- package/compiler/eliscript-expander.el +147 -10
- package/compiler/eliscript-ir-emitter.el +725 -208
- package/compiler/eliscript-lower.el +127 -1
- package/compiler/eliscript-portable.el +177 -51
- package/compiler/eliscript-project.el +20 -2
- package/compiler/eliscript-reader.el +141 -57
- package/compiler/eliscript-source-map.el +26 -12
- package/compiler/eliscript-transient-analysis.el +382 -19
- package/dist/backends/async.mjs +561 -0
- package/dist/backends/async.mjs.macro-origins.json +1 -0
- package/dist/backends/async.mjs.map +1 -0
- package/dist/backends/binary.mjs +381 -0
- package/dist/backends/binary.mjs.macro-origins.json +1 -0
- package/dist/backends/binary.mjs.map +1 -0
- package/dist/backends/capabilities.mjs +237 -0
- package/dist/backends/capabilities.mjs.macro-origins.json +1 -0
- package/dist/backends/capabilities.mjs.map +1 -0
- package/dist/backends/elf.mjs +540 -0
- package/dist/backends/elf.mjs.macro-origins.json +1 -0
- package/dist/backends/elf.mjs.map +1 -0
- package/dist/backends/managed.mjs +10616 -0
- package/dist/backends/managed.mjs.macro-origins.json +1 -0
- package/dist/backends/managed.mjs.map +1 -0
- package/dist/backends/memory.mjs +278 -0
- package/dist/backends/memory.mjs.macro-origins.json +1 -0
- package/dist/backends/memory.mjs.map +1 -0
- package/dist/backends/native.mjs +4099 -0
- package/dist/backends/native.mjs.macro-origins.json +1 -0
- package/dist/backends/native.mjs.map +1 -0
- package/dist/backends/numeric.mjs +2458 -0
- package/dist/backends/numeric.mjs.macro-origins.json +1 -0
- package/dist/backends/numeric.mjs.map +1 -0
- package/dist/backends/optimize.mjs +204 -0
- package/dist/backends/optimize.mjs.macro-origins.json +1 -0
- package/dist/backends/optimize.mjs.map +1 -0
- package/dist/backends/regexp.mjs +2033 -0
- package/dist/backends/regexp.mjs.macro-origins.json +1 -0
- package/dist/backends/regexp.mjs.map +1 -0
- package/dist/backends/sha256.mjs +310 -0
- package/dist/backends/sha256.mjs.macro-origins.json +1 -0
- package/dist/backends/sha256.mjs.map +1 -0
- package/dist/backends/wasm.mjs +2258 -0
- package/dist/backends/wasm.mjs.macro-origins.json +1 -0
- package/dist/backends/wasm.mjs.map +1 -0
- package/dist/bootstrap/analyzer.mjs +1908 -776
- package/dist/bootstrap/analyzer.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +450 -142
- package/dist/bootstrap/compiler.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +3083 -909
- package/dist/bootstrap/emitter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +2887 -1233
- package/dist/bootstrap/expander.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/formatter.mjs +582 -218
- package/dist/bootstrap/formatter.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/formatter.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +670 -116
- package/dist/bootstrap/ir.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/lower.mjs +866 -257
- package/dist/bootstrap/lower.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/lower.mjs.map +1 -1
- package/dist/bootstrap/package.json +1 -0
- package/dist/bootstrap/project.mjs +1168 -498
- package/dist/bootstrap/project.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +674 -175
- package/dist/bootstrap/reader.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/runtime/math.mjs +1117 -0
- package/dist/bootstrap/runtime/math.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs +10125 -0
- package/dist/bootstrap/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/bootstrap/runtime/unicode-case.mjs +281 -0
- package/dist/bootstrap/runtime/unicode-case.mjs.map +1 -0
- package/dist/bootstrap/source-map.mjs +430 -119
- package/dist/bootstrap/source-map.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/symbol.mjs +229 -53
- package/dist/bootstrap/symbol.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/symbol.mjs.map +1 -1
- package/dist/bootstrap/syntax.mjs +205 -7
- package/dist/bootstrap/syntax.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/syntax.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +1185 -489
- package/dist/bootstrap/transient-analysis.mjs.macro-origins.json +1 -0
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +199 -6478
- package/dist/browser/host.mjs +446 -0
- package/dist/browser/loader.js +1 -0
- package/dist/browser/loader.mjs +231 -0
- package/dist/browser/worker.mjs +60 -0
- package/dist/compiler-artifact.json +1 -0
- package/dist/host/compiler-session.mjs +2980 -0
- package/dist/host/compiler-session.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-session.mjs.map +1 -0
- package/dist/host/compiler-tools.mjs +1084 -0
- package/dist/host/compiler-tools.mjs.macro-origins.json +1 -0
- package/dist/host/compiler-tools.mjs.map +1 -0
- package/dist/literal-sources/runtime/core/collection-internals.eli +60 -0
- package/dist/literal-sources/runtime/core/collection.eli +579 -0
- package/dist/literal-sources/runtime/core/data-text.eli +290 -0
- package/dist/literal-sources/runtime/core/data.eli +22 -0
- package/dist/literal-sources/runtime/core/identifier.eli +44 -0
- package/dist/literal-sources/runtime/core/lazy-sequence.eli +131 -0
- package/dist/literal-sources/runtime/core/list.eli +19 -0
- package/dist/literal-sources/runtime/core/map.eli +9 -0
- package/dist/literal-sources/runtime/core/metadata-internals.eli +6 -0
- package/dist/literal-sources/runtime/core/metadata.eli +23 -0
- package/dist/literal-sources/runtime/core/object.eli +8 -0
- package/dist/literal-sources/runtime/core/order.eli +123 -0
- package/dist/literal-sources/runtime/core/persistent-kind.eli +28 -0
- package/dist/literal-sources/runtime/core/protocol-error.eli +32 -0
- package/dist/literal-sources/runtime/core/protocol.eli +28 -0
- package/dist/literal-sources/runtime/core/queue.eli +9 -0
- package/dist/literal-sources/runtime/core/record.eli +191 -0
- package/dist/literal-sources/runtime/core/regex.eli +158 -0
- package/dist/literal-sources/runtime/core/sequence.eli +305 -0
- package/dist/literal-sources/runtime/core/set-algebra.eli +28 -0
- package/dist/literal-sources/runtime/core/set.eli +9 -0
- package/dist/literal-sources/runtime/core/sorted.eli +408 -0
- package/dist/literal-sources/runtime/core/text.eli +14 -0
- package/dist/literal-sources/runtime/core/transducer.eli +268 -0
- package/dist/literal-sources/runtime/core/transient.eli +17 -0
- package/dist/literal-sources/runtime/core/truth.eli +4 -0
- package/dist/literal-sources/runtime/core/type.eli +232 -0
- package/dist/literal-sources/runtime/core/value-internals.eli +13 -0
- package/dist/literal-sources/runtime/core/value.eli +19 -0
- package/dist/literal-sources/runtime/core/vector.eli +20 -0
- package/dist/literal-sources/runtime/literals.eli +23 -0
- package/dist/literal-sources/runtime/testing/value.eli +6 -0
- package/dist/literal-sources/runtime/wire/http-rpc.eli +362 -0
- package/dist/literal-sources/runtime/wire/markdown.eli +275 -0
- package/dist/literal-sources/runtime/wire/schema.eli +193 -0
- package/dist/literal-sources/stdlib/bit.eli +36 -0
- package/dist/literal-sources/stdlib/core/data.eli +306 -0
- package/dist/literal-sources/stdlib/core/object.eli +89 -0
- package/dist/literal-sources/stdlib/core/protocol.eli +451 -0
- package/dist/literal-sources/stdlib/core/set.eli +312 -0
- package/dist/literal-sources/stdlib/core/text.eli +103 -0
- package/dist/literal-sources/stdlib/managed-literal-protocols.eli +483 -0
- package/dist/literal-sources/stdlib/managed-literals.eli +1414 -0
- package/dist/literal-sources/stdlib/managed-queue-state.eli +65 -0
- package/dist/literal-sources/stdlib/managed-sorted-state.eli +233 -0
- package/dist/literal-sources/stdlib/managed-transient-state.eli +348 -0
- package/dist/literal-sources/stdlib/managed-value-state.eli +153 -0
- package/dist/literal-sources/stdlib/managed-vector-view-state.eli +102 -0
- package/dist/literal-sources/stdlib/persistent-list.eli +145 -0
- package/dist/literal-sources/stdlib/persistent-map.eli +724 -0
- package/dist/literal-sources/stdlib/persistent-set.eli +236 -0
- package/dist/literal-sources/stdlib/persistent-vector.eli +359 -0
- package/dist/literal-sources/stdlib/value.eli +325 -0
- package/dist/package.json +10 -0
- package/dist/runtime/math.mjs +1116 -0
- package/dist/runtime/math.mjs.macro-origins.json +1 -0
- package/dist/runtime/math.mjs.map +1 -0
- package/dist/runtime/unicode-case-data.mjs +10124 -0
- package/dist/runtime/unicode-case-data.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case-data.mjs.map +1 -0
- package/dist/runtime/unicode-case.mjs +280 -0
- package/dist/runtime/unicode-case.mjs.macro-origins.json +1 -0
- package/dist/runtime/unicode-case.mjs.map +1 -0
- package/dist/runtime.eli +30379 -0
- package/dist/stage3-release.json +1 -0
- package/editor/README.md +1 -1
- package/editor/eliscript-mode.el +1 -1
- package/editor/eliscript-repl.el +1 -1
- package/package.json +97 -10
- package/platform/http.mjs +20 -0
- package/runtime/array-text.mjs +159 -0
- package/runtime/core/map-internals.mjs +27 -9
- package/runtime/core/object-impl.mjs +26 -17
- package/runtime/core/object-impl.mjs.map +1 -1
- package/runtime/core/protocol-impl.mjs +682 -255
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/protocol.mjs +4 -0
- package/runtime/core/record.mjs +23 -2
- package/runtime/core/regex.mjs +4 -0
- package/runtime/core/sorted.mjs +53 -0
- package/runtime/core/text-impl.mjs +167 -48
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/type.mjs +75 -3
- package/runtime/core/vector.mjs +6 -0
- package/runtime/math.eli +429 -0
- package/runtime/math.mjs +1116 -0
- package/runtime/math.mjs.map +1 -0
- package/runtime/number-radix.mjs +105 -0
- package/runtime/unicode-case-data.eli +29 -0
- package/runtime/unicode-case-data.mjs +10124 -0
- package/runtime/unicode-case-data.mjs.map +1 -0
- package/runtime/unicode-case.eli +100 -0
- package/runtime/unicode-case.mjs +280 -0
- package/runtime/unicode-case.mjs.map +1 -0
- package/runtime/wire/http-rpc.mjs +168 -0
- package/runtime/wire/markdown.mjs +196 -0
- package/runtime/wire/schema.mjs +109 -0
- package/stdlib/README.md +54 -0
- package/stdlib/core/protocol.eli +81 -17
- package/stdlib/core/seq.eli +1 -1
- package/stdlib/core/zipper.eli +114 -47
- package/stdlib/gepo.eli +12 -0
- package/stdlib/interop/js.eli +56 -15
- package/stdlib/managed-literal-protocols.eli +483 -0
- package/stdlib/managed-literals.eli +1414 -0
- package/stdlib/managed-protocol-error.eli +32 -0
- package/stdlib/managed-queue-state.eli +65 -0
- package/stdlib/managed-runtime-collection-internals.eli +60 -0
- package/stdlib/managed-runtime-collection.eli +579 -0
- package/stdlib/managed-runtime-data-text.eli +290 -0
- package/stdlib/managed-runtime-data.eli +22 -0
- package/stdlib/managed-runtime-identifier.eli +44 -0
- package/stdlib/managed-runtime-lazy-sequence.eli +131 -0
- package/stdlib/managed-runtime-list.eli +19 -0
- package/stdlib/managed-runtime-literals.eli +23 -0
- package/stdlib/managed-runtime-map.eli +9 -0
- package/stdlib/managed-runtime-metadata-internals.eli +6 -0
- package/stdlib/managed-runtime-metadata.eli +23 -0
- package/stdlib/managed-runtime-object.eli +8 -0
- package/stdlib/managed-runtime-order.eli +123 -0
- package/stdlib/managed-runtime-persistent-kind.eli +28 -0
- package/stdlib/managed-runtime-protocol.eli +28 -0
- package/stdlib/managed-runtime-queue.eli +9 -0
- package/stdlib/managed-runtime-record.eli +191 -0
- package/stdlib/managed-runtime-regex.eli +158 -0
- package/stdlib/managed-runtime-sequence.eli +305 -0
- package/stdlib/managed-runtime-set-algebra.eli +28 -0
- package/stdlib/managed-runtime-set.eli +9 -0
- package/stdlib/managed-runtime-sorted.eli +408 -0
- package/stdlib/managed-runtime-text.eli +14 -0
- package/stdlib/managed-runtime-transducer.eli +268 -0
- package/stdlib/managed-runtime-transient.eli +17 -0
- package/stdlib/managed-runtime-truth.eli +4 -0
- package/stdlib/managed-runtime-type.eli +232 -0
- package/stdlib/managed-runtime-value-internals.eli +13 -0
- package/stdlib/managed-runtime-value.eli +19 -0
- package/stdlib/managed-runtime-vector.eli +20 -0
- package/stdlib/managed-sorted-state.eli +233 -0
- package/stdlib/managed-testing-value.eli +6 -0
- package/stdlib/managed-transient-state.eli +348 -0
- package/stdlib/managed-value-state.eli +153 -0
- package/stdlib/managed-vector-view-state.eli +102 -0
- package/stdlib/managed-wire-http-rpc.eli +362 -0
- package/stdlib/managed-wire-markdown.eli +275 -0
- package/stdlib/managed-wire-schema.eli +193 -0
- package/stdlib/mdp.eli +7 -0
- package/stdlib/mds.eli +4 -0
- package/stdlib/persistent-vector.eli +23 -6
- package/tools/acceptance/check-legacy.mjs +687 -0
- package/tools/acceptance/check.eli +431 -0
- package/tools/acceptance/compile-evidence.el +49 -0
- package/tools/acceptance/finalize-legacy.mjs +498 -0
- package/tools/acceptance/finalize.eli +270 -0
- package/tools/backends/benchmark.mjs +175 -0
- package/tools/backends/build.mjs +135 -0
- package/tools/backends/compile.mjs +94 -0
- package/tools/backends/compiler-bootstrap.mjs +1001 -0
- package/tools/backends/compiler-browser.mjs +361 -0
- package/tools/backends/compiler-build.mjs +1628 -0
- package/tools/backends/compiler-cli-legacy.mjs +334 -0
- package/tools/backends/compiler-cli.mjs +29 -0
- package/tools/backends/compiler-corpus-bit.mjs +234 -0
- package/tools/backends/compiler-corpus-cli-adapters-legacy.mjs +362 -0
- package/tools/backends/compiler-corpus-cli-adapters.mjs +247 -0
- package/tools/backends/compiler-corpus-debugging.mjs +221 -0
- package/tools/backends/compiler-corpus-emitter.mjs +324 -0
- package/tools/backends/compiler-corpus-evaluation-adapters.mjs +65 -0
- package/tools/backends/compiler-corpus-execution-legacy.mjs +769 -0
- package/tools/backends/compiler-corpus-execution.mjs +3324 -0
- package/tools/backends/compiler-corpus-fuzz.mjs +229 -0
- package/tools/backends/compiler-corpus-generations.mjs +208 -0
- package/tools/backends/compiler-corpus-host-context-legacy.mjs +114 -0
- package/tools/backends/compiler-corpus-host-context.mjs +550 -0
- package/tools/backends/compiler-corpus-identity-host.mjs +553 -0
- package/tools/backends/compiler-corpus-identity-value-adapters-legacy.mjs +298 -0
- package/tools/backends/compiler-corpus-identity-value-adapters.mjs +69 -0
- package/tools/backends/compiler-corpus-isolated-exports.mjs +21 -0
- package/tools/backends/compiler-corpus-legacy.mjs +1155 -0
- package/tools/backends/compiler-corpus-literal-provider.mjs +282 -0
- package/tools/backends/compiler-corpus-managed-adapters-legacy.mjs +334 -0
- package/tools/backends/compiler-corpus-managed-adapters.mjs +937 -0
- package/tools/backends/compiler-corpus-managed-cases.mjs +179 -0
- package/tools/backends/compiler-corpus-managed-fixtures-legacy.mjs +879 -0
- package/tools/backends/compiler-corpus-managed-fixtures.mjs +1287 -0
- package/tools/backends/compiler-corpus-matchers.mjs +173 -0
- package/tools/backends/compiler-corpus-original-program.mjs +612 -0
- package/tools/backends/compiler-corpus-process.mjs +765 -0
- package/tools/backends/compiler-corpus-program-driver.mjs +306 -0
- package/tools/backends/compiler-corpus-project-adapters-legacy.mjs +497 -0
- package/tools/backends/compiler-corpus-project-adapters.mjs +340 -0
- package/tools/backends/compiler-corpus-project-entry-host.mjs +511 -0
- package/tools/backends/compiler-corpus-project-transport.mjs +151 -0
- package/tools/backends/compiler-corpus-raw-fixture-observer.mjs +1438 -0
- package/tools/backends/compiler-corpus-raw-language-fixtures.mjs +1456 -0
- package/tools/backends/compiler-corpus-raw-math-fixture.mjs +346 -0
- package/tools/backends/compiler-corpus-raw-special-fixtures.mjs +523 -0
- package/tools/backends/compiler-corpus-reference-legacy.mjs +263 -0
- package/tools/backends/compiler-corpus-reference.mjs +241 -0
- package/tools/backends/compiler-corpus-runtime-adapters-legacy.mjs +843 -0
- package/tools/backends/compiler-corpus-runtime-adapters.mjs +663 -0
- package/tools/backends/compiler-corpus-source-archive.mjs +206 -0
- package/tools/backends/compiler-corpus-tools-artifact-adapters.mjs +410 -0
- package/tools/backends/compiler-corpus-tools-cli.mjs +363 -0
- package/tools/backends/compiler-corpus-tools-reference.mjs +264 -0
- package/tools/backends/compiler-corpus.mjs +2054 -0
- package/tools/backends/compiler-debug.mjs +142 -0
- package/tools/backends/compiler-matrix.mjs +1955 -0
- package/tools/backends/compiler-metadata.mjs +203 -0
- package/tools/backends/compiler-package-browser.mjs +120 -0
- package/tools/backends/compiler-package-legacy.mjs +654 -0
- package/tools/backends/compiler-package.mjs +464 -0
- package/tools/backends/compiler-project.mjs +126 -0
- package/tools/backends/compiler-session.mjs +843 -0
- package/tools/backends/compiler-sha256.mjs +152 -0
- package/tools/backends/compiler-unicode-profile-host.mjs +196 -0
- package/tools/backends/compiler-worker.mjs +573 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs +919 -0
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -0
- package/tools/backends/dist/managed-ir-inventory.mjs +488 -0
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -0
- package/tools/backends/dist/record-grid.mjs +1256 -0
- package/tools/backends/dist/record-grid.mjs.map +1 -0
- package/tools/backends/dist/release-cli.mjs +460 -0
- package/tools/backends/dist/release-cli.mjs.map +1 -0
- package/tools/backends/dist/run-artifact.mjs +517 -0
- package/tools/backends/dist/run-artifact.mjs.map +1 -0
- package/tools/backends/eliscript/compiler-corpus-bit.eli +77 -0
- package/tools/backends/eliscript/compiler-corpus-debugging.eli +70 -0
- package/tools/backends/eliscript/compiler-corpus-project-entry-host.eli +256 -0
- package/tools/backends/managed-foreign-binding.mjs +497 -0
- package/tools/backends/managed-host-legacy.mjs +1181 -0
- package/tools/backends/managed-host-lifecycle.mjs +310 -0
- package/tools/backends/managed-host-object-provider.mjs +155 -0
- package/tools/backends/managed-host-object-realm.mjs +797 -0
- package/tools/backends/managed-host-proxy.mjs +71 -0
- package/tools/backends/managed-host-runtime.mjs +5868 -0
- package/tools/backends/managed-host.mjs +716 -0
- package/tools/backends/managed-module-graph-legacy.mjs +308 -0
- package/tools/backends/managed-module-graph.mjs +694 -0
- package/tools/backends/managed-runtime-host-legacy.mjs +195 -0
- package/tools/backends/managed-runtime.mjs +939 -0
- package/tools/backends/managed-source-view-legacy.mjs +332 -0
- package/tools/backends/managed-source-view.mjs +959 -0
- package/tools/backends/memory-runtime.mjs +100 -0
- package/tools/backends/native-benchmark.mjs +88 -0
- package/tools/backends/native-managed-runtime.mjs +677 -0
- package/tools/backends/native-memory.mjs +768 -0
- package/tools/backends/native-node-memory.mjs +142 -0
- package/tools/backends/native-node-runner.mjs +99 -0
- package/tools/backends/native-node-watchdog.mjs +19 -0
- package/tools/backends/native-node-worker.mjs +75 -0
- package/tools/backends/stage3-targets.mjs +486 -0
- package/tools/bootstrap-command.el +13 -0
- package/tools/bootstrap-runtime.el +101 -0
- package/tools/bootstrap-seed.el +55 -0
- package/tools/project/check-cli.eli +31 -0
- package/tools/project/project-cli.eli +42 -0
- package/tools/project/project.eli +122 -0
- package/tools/runtime/unicode-case-profiles.mjs +13 -0
- package/tools/runtime/unicode-case-runtime.el +57 -0
- package/tools/testing/source-debugging-corpus-host.eli +16 -0
- package/tools/testing/source-debugging.eli +139 -0
- package/tools/testing/stdlib-bit-corpus-host.eli +21 -0
- package/tools/testing/stdlib-bit-corpus-host.mjs +118 -0
- package/tools/testing/stdlib-bit.eli +104 -0
- package/tools/testing/stdlib-bit.mjs +255 -0
- package/bin/eliscript-bootstrap +0 -15
|
@@ -0,0 +1,229 @@
|
|
|
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("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
|
+
var __eliscript_tdz_ready_1;
|
|
7
|
+
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
|
+
var __eliscript_tdz_ready_2;
|
|
10
|
+
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
|
+
var __eliscript_tdz_ready_3;
|
|
13
|
+
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
|
+
import "eliscript/runtime/unicode-case.mjs";
|
|
16
|
+
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
|
+
|
|
108
|
+
import {createHash} from "node:crypto";
|
|
109
|
+
import {Buffer} from "node:buffer";
|
|
110
|
+
import {root} from "./build.mjs";
|
|
111
|
+
import {createOriginalCorpusSourceReader} from "./compiler-corpus-legacy.mjs";
|
|
112
|
+
const id = "original-program:compiler-module-reader-program-fuzz";
|
|
113
|
+
__eliscript_tdz_ready_0 = true;
|
|
114
|
+
const suite = "tests/reader-program-fuzz.test.mjs";
|
|
115
|
+
__eliscript_tdz_ready_1 = true;
|
|
116
|
+
const suite_sha = "d53a6fab62d6ca7f9a58ae56265149d1a8b51ce4b53080da018724a29ce52b6d";
|
|
117
|
+
__eliscript_tdz_ready_2 = true;
|
|
118
|
+
const files = ["tools/backends/eliscript/compiler-corpus-fuzz.eli", "tools/backends/compiler-corpus-fuzz.mjs", "tests/reader-program-fuzz.test.mjs", "tests/eliscript/reader-program-fuzz-acceptance.eli", "tests/reader-program-fuzz-acceptance-selfhosted.test.mjs", "tools/fuzz/reader-program-acceptance.eli", "tools/fuzz/reader-program-acceptance.mjs", "tools/fuzz/reader-program-corpus-host.eli", "tools/fuzz/reader-program-corpus-host.mjs", "tools/fuzz/reader-program-host.eli", "tools/fuzz/reader-program-host.mjs", "tools/fuzz/program-emission-node.eli", "tools/fuzz/program-emission-node.mjs", "tools/fuzz/program-emission-proof.eli", "tools/fuzz/program-emission-proof.mjs", "tools/fuzz/program-emission-oracle.el", "tools/fuzz/reader-program-fuzz.eli", "tools/fuzz/reader-program-fuzz.mjs", "tools/fuzz/reader-program-fuzz-legacy.mjs", "tests/bootstrap-emitter-oracle.el", "tests/bootstrap-analyzer-oracle.el"];
|
|
119
|
+
__eliscript_tdz_ready_3 = true;
|
|
120
|
+
function hash(value) {
|
|
121
|
+
return ((createHash("sha256"))["update"](value))["digest"]("hex");
|
|
122
|
+
}
|
|
123
|
+
function fail(message) {
|
|
124
|
+
return ((__eliscript_value_1) => { throw __eliscript_value_1; })(new (globalThis.TypeError)(message));
|
|
125
|
+
}
|
|
126
|
+
async function transportOriginalFuzzCorpus(document, options) {
|
|
127
|
+
return (await (async (records) => {
|
|
128
|
+
(__eliscript_numeric_relation(">", ((records) ?? []).length, 0) ? (await (async () => {
|
|
129
|
+
if ((!(((records) ?? []).length === 1))) {
|
|
130
|
+
fail("original full fuzz record must be unique");
|
|
131
|
+
}
|
|
132
|
+
return (await (async (record) => {
|
|
133
|
+
return (await (async (original) => {
|
|
134
|
+
return (await (async (execution) => {
|
|
135
|
+
return (await (async (reader) => {
|
|
136
|
+
return (await (async (source) => {
|
|
137
|
+
return (await (async (proofs) => {
|
|
138
|
+
return (await (async (index) => {
|
|
139
|
+
return (await (async () => {
|
|
140
|
+
if ((!((hash(source) === (__eliscript_tdz_read_2())) && ((original)["sourceSha256"] === (__eliscript_tdz_read_2())) && ((original)["suite"] === (__eliscript_tdz_read_1())) && ((execution)["kind"] === "original-program") && ((execution)["timeoutMs"] === 320000) && ((execution)["requiresBun"] === true)))) {
|
|
141
|
+
fail("original full fuzz source identity or execution contract changed");
|
|
142
|
+
}
|
|
143
|
+
((original)["regions"])["forEach"](((region) => {
|
|
144
|
+
if ((!(((region)["sha256"] === hash((source)["slice"]((region)["start"], (region)["end"]))) && ((region)["byteStart"] === (Buffer)["byteLength"]((source)["slice"](0, (region)["start"]))) && ((region)["byteEnd"] === (Buffer)["byteLength"]((source)["slice"](0, (region)["end"])))))) {
|
|
145
|
+
return fail("original full fuzz assertion region changed");
|
|
146
|
+
} else {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
}));
|
|
150
|
+
(await (async () => {
|
|
151
|
+
while (__eliscript_numeric_relation("<", index, (((__eliscript_tdz_read_3())) ?? []).length)) {
|
|
152
|
+
(await (async (filename) => {
|
|
153
|
+
return ((asset) => {
|
|
154
|
+
return ((existing) => {
|
|
155
|
+
return (() => {
|
|
156
|
+
if (__eliscript_truthy(existing)) {
|
|
157
|
+
if ((!(((existing)["sha256"] === (asset)["sha256"]) && ((existing)["bytes"] === (asset)["bytes"]) && ((existing)["encoding"] === (asset)["encoding"]) && ((existing)["content"] === (asset)["content"])))) {
|
|
158
|
+
fail(("original full fuzz asset identity changed: " + filename));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if ((!__eliscript_truthy(existing))) {
|
|
162
|
+
((document)["evidence"])["push"](asset);
|
|
163
|
+
}
|
|
164
|
+
return (proofs)["push"](({"file": filename, "sourceSha256": (asset)["sha256"]}));
|
|
165
|
+
})();
|
|
166
|
+
})(((document)["evidence"])["find"](((item) => {
|
|
167
|
+
return ((item)["file"] === filename);
|
|
168
|
+
})));
|
|
169
|
+
})(await ((reader)["file"](filename)));
|
|
170
|
+
})(((__eliscript_tdz_read_3()))[index]));
|
|
171
|
+
((index = (index + 1)));
|
|
172
|
+
}
|
|
173
|
+
return null;
|
|
174
|
+
})());
|
|
175
|
+
return (await (async (host_file) => {
|
|
176
|
+
return ((host) => {
|
|
177
|
+
return ((assets) => {
|
|
178
|
+
return (() => {
|
|
179
|
+
(proofs)["forEach"](((proof) => {
|
|
180
|
+
{
|
|
181
|
+
const __eliscript_value_2 = (assets)["find"](((item) => {
|
|
182
|
+
return ((item)["file"] === (proof)["file"]);
|
|
183
|
+
}));
|
|
184
|
+
{
|
|
185
|
+
let previous = __eliscript_value_2;
|
|
186
|
+
if (__eliscript_truthy(((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? ((__eliscript_value_4, __eliscript_value_5) => (__eliscript_value_4 !== __eliscript_value_5))((previous)["sourceSha256"], (proof)["sourceSha256"]) : __eliscript_value_3))(previous))) {
|
|
187
|
+
fail("original full fuzz maintained proof changed");
|
|
188
|
+
}
|
|
189
|
+
if ((!__eliscript_truthy(previous))) {
|
|
190
|
+
return (assets)["push"](proof);
|
|
191
|
+
} else {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}));
|
|
197
|
+
{
|
|
198
|
+
const __eliscript_value_6 = Object.assign(({}), execution, ({"host": host_file}));
|
|
199
|
+
{
|
|
200
|
+
let maintained_execution = __eliscript_value_6;
|
|
201
|
+
Reflect.deleteProperty(maintained_execution, "hostSource");
|
|
202
|
+
((record)["execution"] = maintained_execution);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return ((record)["original"] = Object.assign(({}), original, ({"sourceAssets": assets, "assertionSource": ({"file": (__eliscript_tdz_read_1()), "sourceSha256": (__eliscript_tdz_read_2()), "regions": (original)["regions"]}), "maintainedAssertions": ({"sourceFile": "tools/fuzz/reader-program-acceptance.eli", "sourceSha256": ((proofs)["find"](((proof) => {
|
|
206
|
+
return ((proof)["file"] === "tools/fuzz/reader-program-acceptance.eli");
|
|
207
|
+
})))["sourceSha256"], "generatedFile": "tools/fuzz/reader-program-acceptance.mjs", "generatedSha256": ((proofs)["find"](((proof) => {
|
|
208
|
+
return ((proof)["file"] === "tools/fuzz/reader-program-acceptance.mjs");
|
|
209
|
+
})))["sourceSha256"]}), "maintainedTransport": ({"kind": "maintained-eli-complete-fuzz-acceptance", "version": 1, "logicalSuite": (__eliscript_tdz_read_1()), "originalSourceSha256": (__eliscript_tdz_read_2()), "sourceFile": "tools/fuzz/reader-program-corpus-host.eli", "generatedFile": host_file, "generatedSha256": hash(host), "programInputs": 50000, "readerInputs": 50000, "originalTimeoutMs": 320000, "independentOracle": "tools/fuzz/program-emission-oracle.el", "historicalUnicodeCompatibilityDigest": "b31c1f4546e42b3501fcc8a97403b171a6d3bb0ba8976bbe8bf305a235db7024", "currentDigest": "unmodified-complete-emission-bytes", "fallback": false})})));
|
|
210
|
+
})();
|
|
211
|
+
})((((original)["sourceAssets"] ?? []))["slice"]());
|
|
212
|
+
})(await ((reader)["text"](host_file)));
|
|
213
|
+
})("tools/fuzz/reader-program-corpus-host.mjs"));
|
|
214
|
+
})());
|
|
215
|
+
})(0));
|
|
216
|
+
})([]));
|
|
217
|
+
})(await ((reader)["text"]((__eliscript_tdz_read_1())))));
|
|
218
|
+
})(createOriginalCorpusSourceReader(({"sourceRoot": ((options)["sourceRoot"] ?? root)}))));
|
|
219
|
+
})((record)["execution"]));
|
|
220
|
+
})((record)["original"]));
|
|
221
|
+
})((records)[0]));
|
|
222
|
+
})()) : null);
|
|
223
|
+
return document;
|
|
224
|
+
})(((document)["records"])["filter"](((record) => {
|
|
225
|
+
return ((record)["id"] === (__eliscript_tdz_read_0()));
|
|
226
|
+
}))));
|
|
227
|
+
}
|
|
228
|
+
export {transportOriginalFuzzCorpus};
|
|
229
|
+
//# sourceMappingURL=compiler-corpus-fuzz.mjs.map
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import {mkdir, readFile, writeFile} from 'node:fs/promises';
|
|
2
|
+
import {resolve, relative, sep} from 'node:path';
|
|
3
|
+
import {pathToFileURL} from 'node:url';
|
|
4
|
+
import {loadCompilerSources, buildIndependentCompiler, independentCompilerProfiles} from './compiler-build.mjs';
|
|
5
|
+
import {
|
|
6
|
+
archiveCompilerArtifact, archiveCompilerSources, compilerSourceIdentity,
|
|
7
|
+
compilerDigest, compilerFailure, normalizeCompilerHost, openCompilerArtifact, saveCompilerMetadata,
|
|
8
|
+
} from './compiler-bootstrap.mjs';
|
|
9
|
+
|
|
10
|
+
function aborted(signal) {
|
|
11
|
+
if (signal?.aborted) throw signal.reason ?? new Error('original compiler generations aborted');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function localPath(base, path) {
|
|
15
|
+
const result = relative(base, path).split(sep).join('/');
|
|
16
|
+
if (!result || result === '..' || result.startsWith('../')) {
|
|
17
|
+
throw new TypeError('original generation product must remain inside its case archive');
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function frontendModules(context, sources) {
|
|
23
|
+
const actual = sources.modules.filter(module => module.filename.startsWith('bootstrap/compiler/'));
|
|
24
|
+
const declared = context.record.modules ?? context.record.request?.modules;
|
|
25
|
+
if (actual.length !== 13 || !Array.isArray(declared) || declared.length !== actual.length) {
|
|
26
|
+
throw new TypeError('original CLI generations require all thirteen original frontend sources');
|
|
27
|
+
}
|
|
28
|
+
const byFilename = new Map(actual.map(module => [module.filename, module])), seen = new Set();
|
|
29
|
+
for (const module of declared) {
|
|
30
|
+
const original = byFilename.get(module.filename);
|
|
31
|
+
if (!original || seen.has(module.filename) || module.source !== original.source ||
|
|
32
|
+
module.id !== module.filename.slice(0, -4) + '.mjs') {
|
|
33
|
+
throw new TypeError('original CLI frontend source differs from the complete compiler graph');
|
|
34
|
+
}
|
|
35
|
+
seen.add(module.filename);
|
|
36
|
+
}
|
|
37
|
+
return structuredClone(declared);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function requireProducer(artifact, producer, sources, target) {
|
|
41
|
+
const provenance = artifact.provenance;
|
|
42
|
+
if (normalizeCompilerHost(artifact.host) !== target || provenance?.mode !== 'session' ||
|
|
43
|
+
normalizeCompilerHost(provenance.producerHost) !== normalizeCompilerHost(producer.host) ||
|
|
44
|
+
provenance.runtimeCompiled !== true || !Array.isArray(provenance.compiledModuleIds) ||
|
|
45
|
+
JSON.stringify([...provenance.compiledModuleIds].sort()) !== JSON.stringify(sources.modules.map(module => module.id).sort())) {
|
|
46
|
+
throw new Error('original generation was not built entirely by its preceding compiler session');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function requireFrontendProduct(product, modules, target) {
|
|
51
|
+
if (product.target !== target || product.entry !== 'bootstrap/compiler/compiler.mjs') {
|
|
52
|
+
throw new Error('original compiler frontend view changed its entry or target');
|
|
53
|
+
}
|
|
54
|
+
const records = target === 'javascript' ? product.modules : product.descriptor?.project?.modules;
|
|
55
|
+
if (!Array.isArray(records) ||
|
|
56
|
+
JSON.stringify(records.map(module => module.id).sort()) !== JSON.stringify(modules.map(module => module.id).sort())) {
|
|
57
|
+
throw new Error('original compiler frontend view omitted an original module');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Construct three actual successor compilers. No seed/bootstrap fallback is
|
|
62
|
+
// available here: even the first generation must use the selected cell's
|
|
63
|
+
// caller-owned compiler session. The frontend facades and JavaScript/map
|
|
64
|
+
// companions are separate, independently identified products of each successor.
|
|
65
|
+
export async function prepareOriginalCompilerGenerations(context) {
|
|
66
|
+
const contract = context.record?.execution?.compilerGenerations;
|
|
67
|
+
if (contract === undefined) return undefined;
|
|
68
|
+
if (contract.count !== 3 || contract.producer !== 'previous-generation' ||
|
|
69
|
+
contract.target !== 'selected-target' || contract.completeCompiler !== true || contract.sourceMaps !== true ||
|
|
70
|
+
contract.manifestEnvironment !== 'ELISCRIPT_ORIGINAL_COMPILER_GENERATIONS' ||
|
|
71
|
+
contract.manifestFormat !== 'eliscript-original-compiler-generations' || contract.manifestVersion !== 1) {
|
|
72
|
+
throw new TypeError('unsupported original compiler generation contract');
|
|
73
|
+
}
|
|
74
|
+
const options = context.options ?? {}, profile = options.profile;
|
|
75
|
+
if (typeof profile !== 'string' || !Object.hasOwn(independentCompilerProfiles, profile)) {
|
|
76
|
+
throw new TypeError('original compiler generations require an explicit existing compiler profile');
|
|
77
|
+
}
|
|
78
|
+
if (typeof context.session?.request !== 'function' || typeof context.archiveProduct !== 'function') {
|
|
79
|
+
throw new TypeError('original compiler generations require the actual selected session and product archiver');
|
|
80
|
+
}
|
|
81
|
+
const target = normalizeCompilerHost(context.target), directory = resolve(context.directory, 'original-compiler-generations');
|
|
82
|
+
await mkdir(directory, {recursive: true});
|
|
83
|
+
const manifestPath = resolve(directory, 'generations.json');
|
|
84
|
+
const sources = await loadCompilerSources({sourceRoot: context.sourceRoot});
|
|
85
|
+
// The full producer is an ordinary compiler entry, never a phased ESM view.
|
|
86
|
+
// The latter is built separately only for the unchanged public host bodies.
|
|
87
|
+
sources.phased = false;
|
|
88
|
+
const modules = frontendModules(context, sources), identity = compilerSourceIdentity(sources);
|
|
89
|
+
await archiveCompilerSources(sources, resolve(directory, 'sources'));
|
|
90
|
+
const metadata = {
|
|
91
|
+
format: 'eliscript-original-compiler-generations', version: 1, target, profile,
|
|
92
|
+
status: 'constructing', verification: 'unverified', sourceIdentity: identity,
|
|
93
|
+
generations: [], fixedPoint: {verification: 'unverified', comparisons: []},
|
|
94
|
+
};
|
|
95
|
+
await saveCompilerMetadata(manifestPath, metadata);
|
|
96
|
+
const supportingProducts = [];
|
|
97
|
+
let producer = context.session, ownedSession = null, failure, phase = 'build';
|
|
98
|
+
try {
|
|
99
|
+
for (let number = 1; number <= 3; number++) {
|
|
100
|
+
aborted(context.signal);
|
|
101
|
+
const generationDirectory = resolve(directory, 'generation-' + number);
|
|
102
|
+
await mkdir(generationDirectory, {recursive: true});
|
|
103
|
+
const record = {generation: number, producerHost: normalizeCompilerHost(producer.host),
|
|
104
|
+
target, sourceSha256: identity.sha256, status: 'building', verification: 'unverified'};
|
|
105
|
+
metadata.generations.push(record);
|
|
106
|
+
phase = 'generation-' + number + '-build';
|
|
107
|
+
await saveCompilerMetadata(manifestPath, metadata);
|
|
108
|
+
const artifact = await buildIndependentCompiler({
|
|
109
|
+
host: target, outputRoot: resolve(generationDirectory, 'compiler'), sourceRoot: context.sourceRoot,
|
|
110
|
+
sources: structuredClone(sources), session: producer, profile,
|
|
111
|
+
budget: options.budget, memory: options.memory, auto: options.auto,
|
|
112
|
+
nativeTarget: options.nativeTarget, signal: context.signal,
|
|
113
|
+
retainIR: options.retainIR ?? true, debug: options.debug ?? true,
|
|
114
|
+
});
|
|
115
|
+
requireProducer(artifact, producer, sources, target);
|
|
116
|
+
record.fullCompiler = await archiveCompilerArtifact(artifact, resolve(generationDirectory, 'compiler-metadata'));
|
|
117
|
+
record.status = 'built';
|
|
118
|
+
supportingProducts.push({role: 'original-compiler-generation-full', generation: number, target,
|
|
119
|
+
producerHost: record.producerHost, directory: localPath(context.directory, artifact.directory),
|
|
120
|
+
identitySha256: record.fullCompiler.productIdentity.sha256});
|
|
121
|
+
phase = 'generation-' + number + '-initialize';
|
|
122
|
+
await saveCompilerMetadata(manifestPath, metadata);
|
|
123
|
+
const next = await openCompilerArtifact(artifact, options.sessionOptions);
|
|
124
|
+
const previousOwned = ownedSession;
|
|
125
|
+
ownedSession = next; producer = next;
|
|
126
|
+
if (previousOwned) await previousOwned.close();
|
|
127
|
+
aborted(context.signal);
|
|
128
|
+
phase = 'generation-' + number + '-frontend-runtime';
|
|
129
|
+
await producer.request({operation: 'runtime', source: sources.runtime.source, filename: sources.runtime.filename,
|
|
130
|
+
...(Object.hasOwn(sources, 'literalSources') ? {literalSources: sources.literalSources} : {})}, {signal: context.signal});
|
|
131
|
+
const request = {operation: 'project', modules: structuredClone(modules),
|
|
132
|
+
entry: 'bootstrap/compiler/compiler.mjs', entries: modules.map(module => module.id),
|
|
133
|
+
resolveImports: true, phased: true, sourceMap: true, target,
|
|
134
|
+
memory: options.memory ?? artifact.memory, nativeTarget: options.nativeTarget ?? artifact.nativeTarget,
|
|
135
|
+
nativeFormat: 'library', debug: options.debug ?? true};
|
|
136
|
+
phase = 'generation-' + number + '-frontend-view';
|
|
137
|
+
const response = await producer.request(request, {signal: context.signal});
|
|
138
|
+
const view = await context.archiveProduct(response, 'original-generation-' + number + '-frontend-view', target);
|
|
139
|
+
requireFrontendProduct(view, modules, target);
|
|
140
|
+
record.frontendView = {producerHost: normalizeCompilerHost(producer.host), target,
|
|
141
|
+
identitySha256: view.identitySha256, directory: localPath(context.directory, view.directory)};
|
|
142
|
+
supportingProducts.push({role: 'original-compiler-generation-frontend-view', generation: number, ...record.frontendView});
|
|
143
|
+
phase = 'generation-' + number + '-javascript-companion';
|
|
144
|
+
const javascript = await producer.request({...request, target: 'javascript', phased: false}, {signal: context.signal});
|
|
145
|
+
const companion = await context.archiveProduct(javascript, 'original-generation-' + number + '-javascript-companion', 'javascript');
|
|
146
|
+
requireFrontendProduct(companion, modules, 'javascript');
|
|
147
|
+
record.javascriptCompanion = {producerHost: normalizeCompilerHost(producer.host), target: 'javascript',
|
|
148
|
+
identitySha256: companion.identitySha256, directory: localPath(context.directory, companion.directory)};
|
|
149
|
+
supportingProducts.push({role: 'original-compiler-generation-javascript-companion', generation: number, ...record.javascriptCompanion});
|
|
150
|
+
for (const module of companion.modules) {
|
|
151
|
+
if (typeof module.sourceMapPath !== 'string' || typeof module.sourceMapSha256 !== 'string') {
|
|
152
|
+
throw new Error('original compiler generation omitted an actual JavaScript source map');
|
|
153
|
+
}
|
|
154
|
+
const bytes = await readFile(module.sourceMapPath);
|
|
155
|
+
if (compilerDigest(bytes) !== module.sourceMapSha256) throw new Error('original compiler source map changed after emission');
|
|
156
|
+
if (target !== 'javascript') {
|
|
157
|
+
const path = resolve(view.directory, module.id + '.map');
|
|
158
|
+
await mkdir(resolve(path, '..'), {recursive: true});
|
|
159
|
+
await writeFile(path, bytes, {flag: 'wx'});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
record.compilerDirectory = resolve(view.directory, 'bootstrap/compiler');
|
|
163
|
+
record.javascriptDirectory = resolve(companion.directory, 'bootstrap/compiler');
|
|
164
|
+
if (target !== 'javascript') {
|
|
165
|
+
const configuration = resolve(generationDirectory, 'frontend-context.json');
|
|
166
|
+
await saveCompilerMetadata(configuration, {
|
|
167
|
+
target, path: view.path, descriptor: view.descriptor, typed: view.typed,
|
|
168
|
+
nativeTarget: view.nativeTarget ?? options.nativeTarget ?? artifact.nativeTarget,
|
|
169
|
+
entry: view.entry, base: pathToFileURL(view.directory + sep).href,
|
|
170
|
+
sourceRoot: context.sourceRoot, memory: options.memory ?? artifact.memory,
|
|
171
|
+
runtimeOptions: {...options.runtimeOptions,
|
|
172
|
+
...(options.auto === undefined ? {} : {auto: options.auto}),
|
|
173
|
+
...(view.debug ? {debug: view.debug} : {})},
|
|
174
|
+
});
|
|
175
|
+
record.context = configuration;
|
|
176
|
+
}
|
|
177
|
+
record.status = 'constructed';
|
|
178
|
+
const previous = metadata.generations.at(-2);
|
|
179
|
+
if (previous) {
|
|
180
|
+
const left = previous.fullCompiler.productIdentity.sha256, right = record.fullCompiler.productIdentity.sha256;
|
|
181
|
+
metadata.fixedPoint.comparisons.push({from: previous.generation, to: number,
|
|
182
|
+
identities: [left, right], status: left === right ? 'identical' : 'different'});
|
|
183
|
+
}
|
|
184
|
+
await saveCompilerMetadata(manifestPath, metadata);
|
|
185
|
+
}
|
|
186
|
+
phase = 'complete-target-artifact-fixed-point';
|
|
187
|
+
metadata.fixedPoint.status = metadata.fixedPoint.comparisons.every(item => item.status === 'identical')
|
|
188
|
+
? 'identical' : 'different';
|
|
189
|
+
if (metadata.fixedPoint.status !== 'identical') {
|
|
190
|
+
throw new Error('original compiler generations produced different complete target artifacts');
|
|
191
|
+
}
|
|
192
|
+
metadata.status = 'constructed';
|
|
193
|
+
await saveCompilerMetadata(manifestPath, metadata);
|
|
194
|
+
return {manifestPath, supportingProducts};
|
|
195
|
+
} catch (error) {
|
|
196
|
+
failure = error; metadata.status = 'failed'; metadata.failure = {phase, ...compilerFailure(error)};
|
|
197
|
+
await saveCompilerMetadata(manifestPath, metadata); throw error;
|
|
198
|
+
} finally {
|
|
199
|
+
if (ownedSession) {
|
|
200
|
+
try {await ownedSession.close();}
|
|
201
|
+
catch (error) {
|
|
202
|
+
metadata.cleanupFailure = compilerFailure(error); metadata.status = 'failed';
|
|
203
|
+
await saveCompilerMetadata(manifestPath, metadata);
|
|
204
|
+
if (!failure) throw error;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import {readFile,writeFile} from 'node:fs/promises';
|
|
2
|
+
import {resolve} from 'node:path';
|
|
3
|
+
import {pathToFileURL,fileURLToPath} from 'node:url';
|
|
4
|
+
import {readCompilerMetadata} from './compiler-metadata.mjs';
|
|
5
|
+
import {
|
|
6
|
+
createManagedModuleGraph,
|
|
7
|
+
createManagedProjectFacades,
|
|
8
|
+
instantiateManagedRuntimeWithHostModules,
|
|
9
|
+
} from './managed-runtime.mjs';
|
|
10
|
+
|
|
11
|
+
const contexts = new Map();
|
|
12
|
+
const environmentKey = 'ELISCRIPT_ORIGINAL_PROGRAM_CONTEXT';
|
|
13
|
+
|
|
14
|
+
// This installs an already emitted program. No source is compiled here, and a
|
|
15
|
+
// native context continues through the native loader in every host process.
|
|
16
|
+
export async function openOriginalProgramContext(input, {identity} = {}) {
|
|
17
|
+
const key = identity === undefined ? undefined : resolve(identity);
|
|
18
|
+
if (key !== undefined && contexts.has(key)) return contexts.get(key);
|
|
19
|
+
const pending = (async () => {
|
|
20
|
+
if (!input || !['wasm', 'native'].includes(input.target) || typeof input.path !== 'string' ||
|
|
21
|
+
typeof input.base !== 'string' || typeof input.entry !== 'string' || !input.descriptor?.project) {
|
|
22
|
+
throw new TypeError('original program context requires the selected phased binary artifact');
|
|
23
|
+
}
|
|
24
|
+
const graph = createManagedModuleGraph(input.descriptor);
|
|
25
|
+
const facades = createManagedProjectFacades(input.descriptor, {entry: input.entry});
|
|
26
|
+
let runtime, closed = false;
|
|
27
|
+
async function close() {
|
|
28
|
+
if (closed) return;
|
|
29
|
+
closed = true;
|
|
30
|
+
let failure;
|
|
31
|
+
for (const action of [() => runtime?.closeModule(), () => runtime?.collect(),
|
|
32
|
+
() => {if(runtime&&runtime.live()!==0)throw new Error('original program retained managed values after module close');},
|
|
33
|
+
() => {if(runtime&&runtime.stats().frameDepth!==0)throw new Error('original program retained managed frames after module close');},
|
|
34
|
+
() => runtime?.close?.(), () => graph.close()]) {
|
|
35
|
+
try {await action();} catch (error) {failure ??= error;}
|
|
36
|
+
}
|
|
37
|
+
if (key !== undefined) contexts.delete(key);
|
|
38
|
+
if (failure) throw failure;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const options = {...input.memory, ...input.runtimeOptions, moduleGraph: graph,
|
|
42
|
+
initializeModule: false, projectEntry: input.entry, projectModuleBaseURL: input.base,
|
|
43
|
+
moduleBaseURL: pathToFileURL(input.path).href, nativeTarget: input.nativeTarget};
|
|
44
|
+
if (input.target === 'wasm') {
|
|
45
|
+
runtime = await instantiateManagedRuntimeWithHostModules(new Uint8Array(await readFile(input.path)), options);
|
|
46
|
+
} else {
|
|
47
|
+
const {instantiateNativeManagedRuntime} = await import('./native-managed-runtime.mjs');
|
|
48
|
+
runtime = await instantiateNativeManagedRuntime(input.path, {typed: input.typed, descriptor: input.descriptor}, options);
|
|
49
|
+
}
|
|
50
|
+
if(input.runtimeOptions?.auto!==undefined)runtime.auto(input.runtimeOptions.auto);
|
|
51
|
+
graph.attachRuntime(runtime).prepare();
|
|
52
|
+
const registry = await import(new URL(facades.registry, input.base));
|
|
53
|
+
registry.install(graph);
|
|
54
|
+
return Object.freeze({graph, runtime, facades, close});
|
|
55
|
+
} catch (error) {
|
|
56
|
+
try {await close();} catch { /* Preserve the original loader/prepare error. */ }
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
})();
|
|
60
|
+
if (key !== undefined) contexts.set(key, pending);
|
|
61
|
+
try {return await pending;}
|
|
62
|
+
catch (error) {if (key !== undefined && contexts.get(key) === pending) contexts.delete(key);throw error;}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// NODE_OPTIONS is inherited by the original suite's real Node subprocesses.
|
|
66
|
+
// The parent host keeps its original executable and command arguments. Each
|
|
67
|
+
// child installs fresh VM cells for the same product before its original code.
|
|
68
|
+
export function inheritOriginalProgramContext({configuration, sourceRoot}) {
|
|
69
|
+
if (typeof configuration !== 'string' || typeof sourceRoot !== 'string') {
|
|
70
|
+
throw new TypeError('original child context requires its actual configuration and source root');
|
|
71
|
+
}
|
|
72
|
+
const option = '--import=' + import.meta.url;
|
|
73
|
+
const previous = process.env.NODE_OPTIONS ?? '';
|
|
74
|
+
process.env.NODE_OPTIONS = previous.split(/\s+/).includes(option) ? previous : (previous ? previous + ' ' : '') + option;
|
|
75
|
+
process.env[environmentKey] = resolve(configuration);
|
|
76
|
+
process.env.ELISCRIPT_ORIGINAL_SOURCE_ROOT = resolve(sourceRoot);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Shell entry points accept one runtime executable, rather than an executable
|
|
80
|
+
// plus preload arguments. Keep the actual Bun host and add only the selected
|
|
81
|
+
// artifact's initialization before its unchanged CLI program starts.
|
|
82
|
+
export async function originalProgramBunLauncher({directory,bun,configuration,sourceRoot}) {
|
|
83
|
+
if([directory,bun,configuration,sourceRoot].some(value=>typeof value!=='string'||!value))
|
|
84
|
+
throw new TypeError('original Bun launcher requires its selected artifact and executable');
|
|
85
|
+
const quote=value=>"'"+value.replaceAll("'","'\\''")+"'";
|
|
86
|
+
const option='--import='+import.meta.url;
|
|
87
|
+
const nodeOptions=(process.env.NODE_OPTIONS??'').split(/\s+/).filter(value=>value&&value!==option).join(' ');
|
|
88
|
+
const path=resolve(directory,'__eliscript_original_bun');
|
|
89
|
+
const source='#!/bin/sh\n'+
|
|
90
|
+
'export NODE_OPTIONS='+quote(nodeOptions)+'\n'+
|
|
91
|
+
'if [ -z "${'+environmentKey+':-}" ]; then\n'+
|
|
92
|
+
' export '+environmentKey+'='+quote(resolve(configuration))+'\n'+
|
|
93
|
+
'fi\n'+
|
|
94
|
+
'export ELISCRIPT_ORIGINAL_SOURCE_ROOT='+quote(resolve(sourceRoot))+'\n'+
|
|
95
|
+
'exec '+quote(bun)+' --preload '+quote(fileURLToPath(import.meta.url))+' "$@"\n';
|
|
96
|
+
await writeFile(path,source,{flag:'wx',mode:0o700});
|
|
97
|
+
return path;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// This branch is reached only through the explicit original-program preload.
|
|
101
|
+
// Importing the scheduler or defining an adapter never executes an artifact.
|
|
102
|
+
const inherited = process.env[environmentKey];
|
|
103
|
+
if (inherited) {
|
|
104
|
+
const input = await readCompilerMetadata(resolve(inherited));
|
|
105
|
+
const context = await openOriginalProgramContext(input, {identity: inherited});
|
|
106
|
+
process.env.ELISCRIPT_ORIGINAL_TARGET = input.target;
|
|
107
|
+
if (input.sourceRoot) process.env.ELISCRIPT_ORIGINAL_SOURCE_ROOT = input.sourceRoot;
|
|
108
|
+
process.once('beforeExit', () => {
|
|
109
|
+
context.close().catch(error => {
|
|
110
|
+
process.stderr.write((error?.stack ?? String(error)) + '\n');
|
|
111
|
+
if (!process.exitCode) process.exitCode = 1;
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|