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.
- package/README.md +61 -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.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 +732 -11
- package/browser/worker.mjs +6 -3
- 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 +1078 -0
- package/dist/browser/loader.js +1 -0
- package/dist/browser/loader.mjs +231 -0
- package/dist/browser/worker.mjs +63 -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 +639 -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 +40 -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 +25 -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 +494 -0
- package/dist/literal-sources/stdlib/managed-literals.eli +1469 -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 +106 -11
- 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 +172 -72
- package/stdlib/gepo.eli +12 -0
- package/stdlib/interop/js.eli +56 -15
- package/stdlib/managed-literal-protocols.eli +494 -0
- package/stdlib/managed-literals.eli +1469 -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 +639 -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 +40 -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 +25 -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 +462 -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 +493 -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
package/browser/worker.mjs
CHANGED
|
@@ -14,9 +14,12 @@ import { compileProject, compileSource, outputPathFor } from "./host.mjs";
|
|
|
14
14
|
function externalResolver(runtimeBase) {
|
|
15
15
|
if (typeof runtimeBase !== "string" || runtimeBase.length === 0) return undefined;
|
|
16
16
|
const base = new URL(runtimeBase);
|
|
17
|
-
return (specifier) =>
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
return (specifier) => {
|
|
18
|
+
if (!specifier.startsWith("eliscript/")) return undefined;
|
|
19
|
+
const subpath = specifier.slice("eliscript/".length);
|
|
20
|
+
const normalized = /\.[a-z0-9]+$/iu.test(subpath) ? subpath : `${subpath}.mjs`;
|
|
21
|
+
return new URL(normalized, base).href;
|
|
22
|
+
};
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
function compile(request) {
|
|
@@ -528,8 +528,376 @@ When ASYNCHRONOUS is non-nil, allow `await' in this function body."
|
|
|
528
528
|
(eliscript-analyzer--analyze-non-tail operator-form scope)
|
|
529
529
|
(eliscript-analyzer--analyze-non-tail-sequence arguments scope)))))
|
|
530
530
|
|
|
531
|
+
(defvar eliscript-analyzer--expression-tasks nil)
|
|
532
|
+
(defvar eliscript-analyzer--pending-tasks nil)
|
|
533
|
+
(defvar eliscript-analyzer--task-active nil)
|
|
534
|
+
|
|
535
|
+
(defun eliscript-analyzer--enqueue (action)
|
|
536
|
+
"Enqueue ACTION after earlier siblings with its exact analysis context."
|
|
537
|
+
(let ((span eliscript-analyzer--current-span)
|
|
538
|
+
(tail eliscript-analyzer--tail-position)
|
|
539
|
+
(targets eliscript-analyzer--recur-targets)
|
|
540
|
+
(barrier eliscript-analyzer--recur-barrier))
|
|
541
|
+
(push (lambda ()
|
|
542
|
+
(let ((eliscript-analyzer--current-span span)
|
|
543
|
+
(eliscript-analyzer--tail-position tail)
|
|
544
|
+
(eliscript-analyzer--recur-targets targets)
|
|
545
|
+
(eliscript-analyzer--recur-barrier barrier))
|
|
546
|
+
(funcall action)))
|
|
547
|
+
eliscript-analyzer--pending-tasks)))
|
|
548
|
+
|
|
549
|
+
(defun eliscript-analyzer--enqueue-expression (form scope tail)
|
|
550
|
+
"Enqueue FORM in SCOPE with explicit TAIL status."
|
|
551
|
+
(let ((eliscript-analyzer--tail-position tail))
|
|
552
|
+
(eliscript-analyzer--enqueue
|
|
553
|
+
(lambda () (eliscript-analyzer--analyze-expression-step form scope)))))
|
|
554
|
+
|
|
555
|
+
(defun eliscript-analyzer--enqueue-sequence (forms scope tail)
|
|
556
|
+
"Enqueue FORMS in original order, assigning TAIL only to the last form."
|
|
557
|
+
(while forms
|
|
558
|
+
(eliscript-analyzer--enqueue-expression
|
|
559
|
+
(car forms) scope (and tail (null (cdr forms))))
|
|
560
|
+
(setq forms (cdr forms))))
|
|
561
|
+
|
|
562
|
+
(defun eliscript-analyzer--enqueue-defaults (pattern scope)
|
|
563
|
+
"Enqueue pattern-default validation followed by its expressions in SCOPE."
|
|
564
|
+
(eliscript-analyzer--enqueue
|
|
565
|
+
(lambda ()
|
|
566
|
+
(let ((defaults
|
|
567
|
+
(eliscript-binding-defaults
|
|
568
|
+
pattern
|
|
569
|
+
(lambda (form message)
|
|
570
|
+
(let ((eliscript-analyzer--current-span
|
|
571
|
+
(or (eliscript-form-span form)
|
|
572
|
+
eliscript-analyzer--current-span)))
|
|
573
|
+
(eliscript-analyzer--fail "%s" message))))))
|
|
574
|
+
(eliscript-analyzer--enqueue-sequence defaults scope nil)))))
|
|
575
|
+
|
|
576
|
+
(defun eliscript-analyzer--enqueue-let (arguments scope sequential)
|
|
577
|
+
"Schedule let ARGUMENTS with the original SEQUENTIAL binding visibility."
|
|
578
|
+
(unless arguments
|
|
579
|
+
(eliscript-analyzer--fail "%s requires a binding list"
|
|
580
|
+
(if sequential "let*" "let")))
|
|
581
|
+
(let* ((bindings-form (car arguments))
|
|
582
|
+
(bindings (eliscript-form-value bindings-form))
|
|
583
|
+
(child (eliscript-analyzer--make-scope scope))
|
|
584
|
+
(tail eliscript-analyzer--tail-position))
|
|
585
|
+
(unless (proper-list-p bindings)
|
|
586
|
+
(let ((eliscript-analyzer--current-span
|
|
587
|
+
(or (eliscript-form-span bindings-form)
|
|
588
|
+
eliscript-analyzer--current-span)))
|
|
589
|
+
(eliscript-analyzer--fail "let bindings must be a list")))
|
|
590
|
+
(if sequential
|
|
591
|
+
(dolist (binding bindings)
|
|
592
|
+
;; Parse each sequential binding only after the preceding initializer,
|
|
593
|
+
;; defaults and declaration, preserving both visibility and first error.
|
|
594
|
+
(let ((binding binding))
|
|
595
|
+
(eliscript-analyzer--enqueue
|
|
596
|
+
(lambda ()
|
|
597
|
+
(pcase-let ((`(,name ,value)
|
|
598
|
+
(eliscript-analyzer--binding-pair binding)))
|
|
599
|
+
(eliscript-analyzer--enqueue-expression value child nil)
|
|
600
|
+
(eliscript-analyzer--enqueue-defaults name child)
|
|
601
|
+
(eliscript-analyzer--enqueue
|
|
602
|
+
(lambda ()
|
|
603
|
+
(eliscript-analyzer--declare-pattern
|
|
604
|
+
child name 'local t))))))))
|
|
605
|
+
;; Parallel let validates every binding shape before any initializer, then
|
|
606
|
+
;; evaluates all initializers/defaults in the parent scope before declaring.
|
|
607
|
+
(let ((parsed (mapcar #'eliscript-analyzer--binding-pair bindings)))
|
|
608
|
+
(dolist (binding parsed)
|
|
609
|
+
(eliscript-analyzer--enqueue-expression (cadr binding) scope nil)
|
|
610
|
+
(eliscript-analyzer--enqueue-defaults (car binding) scope))
|
|
611
|
+
(eliscript-analyzer--enqueue
|
|
612
|
+
(lambda ()
|
|
613
|
+
(dolist (binding parsed)
|
|
614
|
+
(eliscript-analyzer--declare-pattern
|
|
615
|
+
child (car binding) 'local t))))))
|
|
616
|
+
(eliscript-analyzer--enqueue-sequence (cdr arguments) child tail)))
|
|
617
|
+
|
|
618
|
+
(defun eliscript-analyzer--enqueue-function
|
|
619
|
+
(parameters body scope asynchronous)
|
|
620
|
+
"Schedule PARAMETERS and BODY in a new ASYNCHRONOUS function context."
|
|
621
|
+
(let ((parsed
|
|
622
|
+
(eliscript-parameters-parse
|
|
623
|
+
parameters
|
|
624
|
+
(lambda (form message)
|
|
625
|
+
(let ((eliscript-analyzer--current-span
|
|
626
|
+
(or (eliscript-form-span form)
|
|
627
|
+
eliscript-analyzer--current-span)))
|
|
628
|
+
(eliscript-analyzer--fail "%s" message))))))
|
|
629
|
+
(dolist (parameter parsed)
|
|
630
|
+
(eliscript-analyzer--enqueue-defaults
|
|
631
|
+
(eliscript-parameter-form parameter) scope))
|
|
632
|
+
(eliscript-analyzer--enqueue
|
|
633
|
+
(lambda ()
|
|
634
|
+
(let ((child (eliscript-analyzer--make-scope
|
|
635
|
+
scope (if asynchronous 'async 'sync)))
|
|
636
|
+
(target (eliscript-analyzer--recur-target-create
|
|
637
|
+
:kind 'function :arity (length parsed))))
|
|
638
|
+
(dolist (parameter parsed)
|
|
639
|
+
(eliscript-analyzer--declare-pattern
|
|
640
|
+
child (eliscript-parameter-form parameter) 'parameter t))
|
|
641
|
+
(let ((eliscript-analyzer--recur-targets (list target))
|
|
642
|
+
(eliscript-analyzer--recur-barrier nil))
|
|
643
|
+
(eliscript-analyzer--enqueue-sequence body child t)))))))
|
|
644
|
+
|
|
645
|
+
(defun eliscript-analyzer--enqueue-loop (arguments scope)
|
|
646
|
+
"Schedule LOOP ARGUMENTS without capturing the parent's recur target."
|
|
647
|
+
(unless arguments (eliscript-analyzer--fail "loop requires a binding list"))
|
|
648
|
+
(let* ((bindings-form (car arguments))
|
|
649
|
+
(bindings (eliscript-form-value bindings-form))
|
|
650
|
+
(child (eliscript-analyzer--make-scope scope)))
|
|
651
|
+
(unless (proper-list-p bindings)
|
|
652
|
+
(let ((eliscript-analyzer--current-span
|
|
653
|
+
(or (eliscript-form-span bindings-form)
|
|
654
|
+
eliscript-analyzer--current-span)))
|
|
655
|
+
(eliscript-analyzer--fail "loop bindings must be a list")))
|
|
656
|
+
(let ((parsed
|
|
657
|
+
(mapcar
|
|
658
|
+
(lambda (binding)
|
|
659
|
+
(let ((value (eliscript-form-value binding)))
|
|
660
|
+
(unless (and (proper-list-p value) (= (length value) 2))
|
|
661
|
+
(let ((eliscript-analyzer--current-span
|
|
662
|
+
(or (eliscript-form-span binding)
|
|
663
|
+
eliscript-analyzer--current-span)))
|
|
664
|
+
(eliscript-analyzer--fail
|
|
665
|
+
"loop bindings require exactly one initializer: %S"
|
|
666
|
+
(eliscript-form-strip binding))))
|
|
667
|
+
(eliscript-analyzer--binding-pair binding))) bindings)))
|
|
668
|
+
(dolist (binding parsed)
|
|
669
|
+
(eliscript-analyzer--enqueue-expression (cadr binding) scope nil)
|
|
670
|
+
(eliscript-analyzer--enqueue-defaults (car binding) scope))
|
|
671
|
+
(eliscript-analyzer--enqueue
|
|
672
|
+
(lambda ()
|
|
673
|
+
(dolist (binding parsed)
|
|
674
|
+
(eliscript-analyzer--declare-pattern child (car binding) 'loop t))
|
|
675
|
+
(let ((eliscript-analyzer--recur-targets
|
|
676
|
+
(cons (eliscript-analyzer--recur-target-create
|
|
677
|
+
:kind 'loop :arity (length parsed))
|
|
678
|
+
eliscript-analyzer--recur-targets))
|
|
679
|
+
(eliscript-analyzer--recur-barrier nil))
|
|
680
|
+
(eliscript-analyzer--enqueue-sequence (cdr arguments) child t)))))))
|
|
681
|
+
|
|
682
|
+
(defun eliscript-analyzer--enqueue-assignment (arguments scope form-name)
|
|
683
|
+
"Schedule assignment checks and values in the original pair order."
|
|
684
|
+
(when (or (null arguments) (= (% (length arguments) 2) 1))
|
|
685
|
+
(eliscript-analyzer--fail "%s expects one or more name/value pairs" form-name))
|
|
686
|
+
(while arguments
|
|
687
|
+
(let ((name (pop arguments)) (value (pop arguments)))
|
|
688
|
+
(eliscript-analyzer--enqueue
|
|
689
|
+
(lambda ()
|
|
690
|
+
(let* ((name-value (eliscript-form-value name))
|
|
691
|
+
(binding (and (symbolp name-value)
|
|
692
|
+
(eliscript-analyzer--require-binding
|
|
693
|
+
scope name-value))))
|
|
694
|
+
(unless binding
|
|
695
|
+
(eliscript-analyzer--fail "assignment target must be a symbol: %S"
|
|
696
|
+
(eliscript-form-strip name)))
|
|
697
|
+
(unless (eliscript-analyzer--binding-mutable binding)
|
|
698
|
+
(let ((eliscript-analyzer--current-span
|
|
699
|
+
(or (eliscript-form-span name)
|
|
700
|
+
eliscript-analyzer--current-span)))
|
|
701
|
+
(eliscript-analyzer--fail
|
|
702
|
+
"cannot assign to immutable binding: %s" name-value)))
|
|
703
|
+
(eliscript-analyzer--enqueue-expression value scope nil)))))))
|
|
704
|
+
|
|
705
|
+
(defun eliscript-analyzer--enqueue-cond (clauses scope)
|
|
706
|
+
"Schedule COND CLAUSES with original interleaved validation order."
|
|
707
|
+
(dolist (clause clauses)
|
|
708
|
+
(let ((clause clause))
|
|
709
|
+
(eliscript-analyzer--enqueue
|
|
710
|
+
(lambda ()
|
|
711
|
+
(let ((value (eliscript-form-value clause)))
|
|
712
|
+
(unless (and (proper-list-p value) value)
|
|
713
|
+
(let ((eliscript-analyzer--current-span
|
|
714
|
+
(or (eliscript-form-span clause)
|
|
715
|
+
eliscript-analyzer--current-span)))
|
|
716
|
+
(eliscript-analyzer--fail
|
|
717
|
+
"invalid cond clause: %S" (eliscript-form-strip clause))))
|
|
718
|
+
(eliscript-analyzer--enqueue-expression (car value) scope nil)
|
|
719
|
+
(eliscript-analyzer--enqueue-sequence
|
|
720
|
+
(cdr value) scope eliscript-analyzer--tail-position)))))))
|
|
721
|
+
|
|
722
|
+
(defun eliscript-analyzer--enqueue-try (arguments scope)
|
|
723
|
+
"Schedule TRY ARGUMENTS, retaining clause order and the recur barrier."
|
|
724
|
+
(let ((eliscript-analyzer--recur-barrier t)
|
|
725
|
+
(state (vector nil nil nil)))
|
|
726
|
+
(dolist (argument arguments)
|
|
727
|
+
(let ((argument argument))
|
|
728
|
+
(eliscript-analyzer--enqueue
|
|
729
|
+
(lambda ()
|
|
730
|
+
(let ((operator (eliscript-analyzer--clause-operator argument)))
|
|
731
|
+
(cond
|
|
732
|
+
((eq operator 'catch)
|
|
733
|
+
(when (aref state 1)
|
|
734
|
+
(eliscript-analyzer--fail "try accepts at most one catch clause"))
|
|
735
|
+
(when (aref state 2)
|
|
736
|
+
(eliscript-analyzer--fail "catch must precede finally"))
|
|
737
|
+
(aset state 0 t) (aset state 1 t)
|
|
738
|
+
(let* ((clause (eliscript-form-value argument))
|
|
739
|
+
(binding (cadr clause)))
|
|
740
|
+
(unless (and binding (eliscript-binding-pattern-p binding))
|
|
741
|
+
(let ((eliscript-analyzer--current-span
|
|
742
|
+
(or (eliscript-form-span argument)
|
|
743
|
+
eliscript-analyzer--current-span)))
|
|
744
|
+
(eliscript-analyzer--fail
|
|
745
|
+
"catch requires a binding symbol, vector, or map")))
|
|
746
|
+
(eliscript-analyzer--enqueue-defaults binding scope)
|
|
747
|
+
(eliscript-analyzer--enqueue
|
|
748
|
+
(lambda ()
|
|
749
|
+
(let ((child (eliscript-analyzer--make-scope scope)))
|
|
750
|
+
(eliscript-analyzer--declare-pattern child binding 'catch t)
|
|
751
|
+
(eliscript-analyzer--enqueue-sequence
|
|
752
|
+
(cddr clause) child eliscript-analyzer--tail-position))))))
|
|
753
|
+
((eq operator 'finally)
|
|
754
|
+
(when (aref state 2)
|
|
755
|
+
(eliscript-analyzer--fail
|
|
756
|
+
"try accepts at most one finally clause"))
|
|
757
|
+
(aset state 0 t) (aset state 2 t)
|
|
758
|
+
(eliscript-analyzer--enqueue-sequence
|
|
759
|
+
(cdr (eliscript-form-value argument))
|
|
760
|
+
scope eliscript-analyzer--tail-position))
|
|
761
|
+
((aref state 0)
|
|
762
|
+
(let ((eliscript-analyzer--current-span
|
|
763
|
+
(or (eliscript-form-span argument)
|
|
764
|
+
eliscript-analyzer--current-span)))
|
|
765
|
+
(eliscript-analyzer--fail
|
|
766
|
+
"try body forms must precede catch and finally clauses")))
|
|
767
|
+
(t (eliscript-analyzer--enqueue-expression
|
|
768
|
+
argument scope eliscript-analyzer--tail-position))))))))
|
|
769
|
+
(eliscript-analyzer--enqueue
|
|
770
|
+
(lambda ()
|
|
771
|
+
(unless (or (aref state 1) (aref state 2))
|
|
772
|
+
(eliscript-analyzer--fail "try requires a catch or finally clause"))))))
|
|
773
|
+
|
|
774
|
+
(defun eliscript-analyzer--analyze-call-tasks (form scope)
|
|
775
|
+
"Validate call FORM and schedule its descendants using explicit tasks."
|
|
776
|
+
(let* ((items (eliscript-form-value form))
|
|
777
|
+
(operator-form (car items))
|
|
778
|
+
(operator (eliscript-form-value operator-form))
|
|
779
|
+
(arguments (cdr items))
|
|
780
|
+
(tail eliscript-analyzer--tail-position))
|
|
781
|
+
(pcase operator
|
|
782
|
+
((or 'lambda 'fn 'async)
|
|
783
|
+
(unless arguments
|
|
784
|
+
(eliscript-analyzer--fail "%s requires an argument list" operator))
|
|
785
|
+
(eliscript-analyzer--enqueue-function
|
|
786
|
+
(car arguments) (cdr arguments) scope (eq operator 'async)))
|
|
787
|
+
('await
|
|
788
|
+
(unless (= (length arguments) 1)
|
|
789
|
+
(eliscript-analyzer--fail "await expects 1 argument"))
|
|
790
|
+
(unless (eliscript-analyzer--async-function-p scope)
|
|
791
|
+
(eliscript-analyzer--fail "await is only valid inside an async function"))
|
|
792
|
+
(eliscript-analyzer--enqueue-expression (car arguments) scope nil))
|
|
793
|
+
('throw
|
|
794
|
+
(unless (= (length arguments) 1)
|
|
795
|
+
(eliscript-analyzer--fail "throw expects 1 argument"))
|
|
796
|
+
(eliscript-analyzer--enqueue-expression (car arguments) scope nil))
|
|
797
|
+
('try (eliscript-analyzer--enqueue-try arguments scope))
|
|
798
|
+
((or 'catch 'finally)
|
|
799
|
+
(eliscript-analyzer--fail "%s is only valid as a try clause" operator))
|
|
800
|
+
((or 'let 'let*)
|
|
801
|
+
(eliscript-analyzer--enqueue-let arguments scope (eq operator 'let*)))
|
|
802
|
+
('loop (eliscript-analyzer--enqueue-loop arguments scope))
|
|
803
|
+
('recur
|
|
804
|
+
(let ((target (car eliscript-analyzer--recur-targets)))
|
|
805
|
+
(unless target
|
|
806
|
+
(eliscript-analyzer--fail "recur is only valid inside a function or loop"))
|
|
807
|
+
(when eliscript-analyzer--recur-barrier
|
|
808
|
+
(eliscript-analyzer--fail "recur cannot cross a try boundary"))
|
|
809
|
+
(unless tail
|
|
810
|
+
(eliscript-analyzer--fail "recur is only valid in tail position"))
|
|
811
|
+
(unless (= (length arguments) (eliscript-analyzer--recur-target-arity target))
|
|
812
|
+
(eliscript-analyzer--fail
|
|
813
|
+
"recur expects %d arguments for the current %s, got %d"
|
|
814
|
+
(eliscript-analyzer--recur-target-arity target)
|
|
815
|
+
(eliscript-analyzer--recur-target-kind target) (length arguments)))
|
|
816
|
+
(eliscript-analyzer--enqueue-sequence arguments scope nil)))
|
|
817
|
+
('setq (eliscript-analyzer--enqueue-assignment arguments scope "setq"))
|
|
818
|
+
('set!
|
|
819
|
+
(unless (= (length arguments) 2)
|
|
820
|
+
(eliscript-analyzer--fail "set! expects 2 arguments"))
|
|
821
|
+
(eliscript-analyzer--enqueue-assignment arguments scope "set!"))
|
|
822
|
+
('cond (eliscript-analyzer--enqueue-cond arguments scope))
|
|
823
|
+
('if
|
|
824
|
+
(unless (<= 2 (length arguments) 3)
|
|
825
|
+
(eliscript-analyzer--fail "if expects 2..3 arguments"))
|
|
826
|
+
(eliscript-analyzer--enqueue-expression (car arguments) scope nil)
|
|
827
|
+
(dolist (branch (cdr arguments))
|
|
828
|
+
(eliscript-analyzer--enqueue-expression branch scope tail)))
|
|
829
|
+
((or 'when 'unless)
|
|
830
|
+
(unless arguments
|
|
831
|
+
(eliscript-analyzer--fail "%s expects 1+ arguments" operator))
|
|
832
|
+
(eliscript-analyzer--enqueue-expression (car arguments) scope nil)
|
|
833
|
+
(eliscript-analyzer--enqueue-sequence (cdr arguments) scope tail))
|
|
834
|
+
((or 'progn 'do 'and 'or)
|
|
835
|
+
(eliscript-analyzer--enqueue-sequence arguments scope tail))
|
|
836
|
+
('while
|
|
837
|
+
(unless arguments
|
|
838
|
+
(eliscript-analyzer--fail "while expects 1+ arguments"))
|
|
839
|
+
(eliscript-analyzer--enqueue-sequence arguments scope nil))
|
|
840
|
+
('quote nil)
|
|
841
|
+
('js-object
|
|
842
|
+
(when (= (% (length arguments) 2) 1)
|
|
843
|
+
(eliscript-analyzer--fail "js-object expects key/value pairs"))
|
|
844
|
+
(while arguments
|
|
845
|
+
(let ((key (pop arguments)) (value (pop arguments)))
|
|
846
|
+
(unless (let ((key-value (eliscript-form-value key)))
|
|
847
|
+
(or (keywordp key-value) (stringp key-value)
|
|
848
|
+
(symbolp key-value)))
|
|
849
|
+
(eliscript-analyzer--enqueue-expression key scope nil))
|
|
850
|
+
(eliscript-analyzer--enqueue-expression value scope nil))))
|
|
851
|
+
('hash-map
|
|
852
|
+
(when (= (% (length arguments) 2) 1)
|
|
853
|
+
(eliscript-analyzer--fail "hash-map expects complete key/value pairs"))
|
|
854
|
+
(eliscript-analyzer--enqueue-sequence arguments scope nil))
|
|
855
|
+
((or 'get 'put 'js-call)
|
|
856
|
+
(pcase operator
|
|
857
|
+
('get (unless (<= 2 (length arguments) 3)
|
|
858
|
+
(eliscript-analyzer--fail "get expects 2..3 arguments")))
|
|
859
|
+
('put (unless (= (length arguments) 3)
|
|
860
|
+
(eliscript-analyzer--fail "put expects 3 arguments")))
|
|
861
|
+
('js-call (when (< (length arguments) 2)
|
|
862
|
+
(eliscript-analyzer--fail "js-call expects 2+ arguments"))))
|
|
863
|
+
(eliscript-analyzer--enqueue-expression (car arguments) scope nil)
|
|
864
|
+
(let ((key (cadr arguments)))
|
|
865
|
+
(unless (let ((value (eliscript-form-value key)))
|
|
866
|
+
(or (keywordp value) (stringp value)))
|
|
867
|
+
(eliscript-analyzer--enqueue-expression key scope nil)))
|
|
868
|
+
(eliscript-analyzer--enqueue-sequence (nthcdr 2 arguments) scope nil))
|
|
869
|
+
('js* nil)
|
|
870
|
+
((pred (lambda (name) (memq name eliscript-analyzer--builtin-operators)))
|
|
871
|
+
(eliscript-analyzer--enqueue-sequence arguments scope nil))
|
|
872
|
+
((or 'defun 'defn 'defportable 'defasync 'defvar 'defconst
|
|
873
|
+
'export 'export-default 'import 'module)
|
|
874
|
+
(eliscript-analyzer--fail "%s is only valid at module top level" operator))
|
|
875
|
+
(_
|
|
876
|
+
(eliscript-analyzer--enqueue-expression operator-form scope nil)
|
|
877
|
+
(eliscript-analyzer--enqueue-sequence arguments scope nil)))))
|
|
878
|
+
|
|
531
879
|
(defun eliscript-analyzer--analyze-expression (form scope)
|
|
532
|
-
"Analyze
|
|
880
|
+
"Analyze FORM in SCOPE without consuming stack depth for descendants."
|
|
881
|
+
(if eliscript-analyzer--task-active
|
|
882
|
+
(eliscript-analyzer--enqueue-expression
|
|
883
|
+
form scope eliscript-analyzer--tail-position)
|
|
884
|
+
(let ((eliscript-analyzer--task-active t)
|
|
885
|
+
(eliscript-analyzer--expression-tasks nil)
|
|
886
|
+
(eliscript-analyzer--pending-tasks nil))
|
|
887
|
+
(eliscript-analyzer--enqueue-expression
|
|
888
|
+
form scope eliscript-analyzer--tail-position)
|
|
889
|
+
(setq eliscript-analyzer--expression-tasks
|
|
890
|
+
(nreverse eliscript-analyzer--pending-tasks))
|
|
891
|
+
(while eliscript-analyzer--expression-tasks
|
|
892
|
+
(let ((action (pop eliscript-analyzer--expression-tasks))
|
|
893
|
+
(eliscript-analyzer--pending-tasks nil))
|
|
894
|
+
(funcall action)
|
|
895
|
+
(setq eliscript-analyzer--expression-tasks
|
|
896
|
+
(nconc (nreverse eliscript-analyzer--pending-tasks)
|
|
897
|
+
eliscript-analyzer--expression-tasks)))))))
|
|
898
|
+
|
|
899
|
+
(defun eliscript-analyzer--analyze-expression-step (form scope)
|
|
900
|
+
"Analyze one expression FORM in SCOPE and enqueue its descendants."
|
|
533
901
|
(let* ((eliscript-analyzer--current-span
|
|
534
902
|
(or (eliscript-form-span form) eliscript-analyzer--current-span))
|
|
535
903
|
(value (eliscript-form-value form)))
|
|
@@ -545,14 +913,13 @@ When ASYNCHRONOUS is non-nil, allow `await' in this function body."
|
|
|
545
913
|
"%s" (eliscript-diagnostic-condition-message error-data))))
|
|
546
914
|
(eliscript-analyzer--require-binding scope value)))
|
|
547
915
|
((vectorp value)
|
|
548
|
-
(eliscript-analyzer--
|
|
549
|
-
(append value nil) scope))
|
|
916
|
+
(eliscript-analyzer--enqueue-sequence (append value nil) scope nil))
|
|
550
917
|
((consp value)
|
|
551
918
|
(unless (proper-list-p value)
|
|
552
919
|
(eliscript-analyzer--fail
|
|
553
920
|
"dotted call forms are not supported: %S"
|
|
554
921
|
(eliscript-form-strip form)))
|
|
555
|
-
(eliscript-analyzer--analyze-call form scope))
|
|
922
|
+
(eliscript-analyzer--analyze-call-tasks form scope))
|
|
556
923
|
(t (eliscript-analyzer--fail
|
|
557
924
|
"unsupported form: %S" (eliscript-form-strip form))))))
|
|
558
925
|
|
|
@@ -11,6 +11,83 @@
|
|
|
11
11
|
(file-name-directory (or load-file-name buffer-file-name)))
|
|
12
12
|
(require 'eliscript)
|
|
13
13
|
|
|
14
|
+
(defconst eliscript-cli--compiler-directory
|
|
15
|
+
(file-name-as-directory
|
|
16
|
+
(file-truename
|
|
17
|
+
(file-name-directory (or load-file-name buffer-file-name))))
|
|
18
|
+
"Physical directory owning the compiler loaded by this standalone CLI.")
|
|
19
|
+
|
|
20
|
+
(defconst eliscript-cli--ram-bytecompile-minimum-bytes (* 128 1024)
|
|
21
|
+
"Minimum readable input size for the standalone CLI's RAM bytecode pass.")
|
|
22
|
+
|
|
23
|
+
(defvar eliscript-cli--compiler-bytecompiled nil
|
|
24
|
+
"Non-nil after this CLI has prepared its compiler bytecode in RAM once.")
|
|
25
|
+
|
|
26
|
+
(defun eliscript-cli--large-readable-input-p (input)
|
|
27
|
+
"Return non-nil for readable INPUT above the RAM bytecode threshold.
|
|
28
|
+
An inaccessible input must retain the ordinary compiler's file diagnostic."
|
|
29
|
+
(condition-case nil
|
|
30
|
+
(when (file-readable-p input)
|
|
31
|
+
(let* ((attributes (file-attributes (file-truename input)))
|
|
32
|
+
(size (file-attribute-size attributes)))
|
|
33
|
+
(and (null (file-attribute-type attributes))
|
|
34
|
+
(integerp size)
|
|
35
|
+
(>= size eliscript-cli--ram-bytecompile-minimum-bytes))))
|
|
36
|
+
(file-error nil)))
|
|
37
|
+
|
|
38
|
+
(defun eliscript-cli--bytecode-definition-p (definition)
|
|
39
|
+
"Return non-nil for bytecode DEFINITION, including its macro wrapper."
|
|
40
|
+
(or (byte-code-function-p definition)
|
|
41
|
+
(and (eq (car-safe definition) 'macro)
|
|
42
|
+
(byte-code-function-p (cdr definition)))))
|
|
43
|
+
|
|
44
|
+
(defun eliscript-cli--byte-compile-loaded-compiler ()
|
|
45
|
+
"Byte-compile owned loaded compiler definitions once, entirely in RAM.
|
|
46
|
+
Only actual function entries in this compiler directory's `load-history'
|
|
47
|
+
participate. Symbol aliases remain aliases, and shared original function
|
|
48
|
+
values share the same compiled replacement. No library file is written."
|
|
49
|
+
(unless eliscript-cli--compiler-bytecompiled
|
|
50
|
+
(require 'bytecomp)
|
|
51
|
+
(let ((seen (make-hash-table :test #'eq))
|
|
52
|
+
(compiled (make-hash-table :test #'eq))
|
|
53
|
+
(byte-compile-warnings nil)
|
|
54
|
+
(byte-compile-verbose nil)
|
|
55
|
+
(inhibit-message t)
|
|
56
|
+
(message-log-max nil))
|
|
57
|
+
(dolist (entry load-history)
|
|
58
|
+
(let ((filename (car-safe entry)))
|
|
59
|
+
(when (and (stringp filename)
|
|
60
|
+
(file-name-absolute-p filename)
|
|
61
|
+
(file-in-directory-p filename eliscript-cli--compiler-directory))
|
|
62
|
+
(dolist (item (cdr entry))
|
|
63
|
+
(when (and (eq (car-safe item) 'defun)
|
|
64
|
+
(symbolp (cdr item))
|
|
65
|
+
(not (gethash (cdr item) seen)))
|
|
66
|
+
(let* ((name (cdr item))
|
|
67
|
+
(owner (symbol-file name 'defun)))
|
|
68
|
+
(when (and owner
|
|
69
|
+
(equal (file-truename owner) (file-truename filename)))
|
|
70
|
+
(puthash name t seen)
|
|
71
|
+
(when (fboundp name)
|
|
72
|
+
(let ((definition (symbol-function name)))
|
|
73
|
+
(when (and (not (symbolp definition))
|
|
74
|
+
(not (subrp definition))
|
|
75
|
+
(not (autoloadp definition))
|
|
76
|
+
(not (eliscript-cli--bytecode-definition-p definition))
|
|
77
|
+
(or (functionp definition)
|
|
78
|
+
(and (eq (car-safe definition) 'macro)
|
|
79
|
+
(not (subrp (cdr definition))))))
|
|
80
|
+
(let ((replacement (gethash definition compiled)))
|
|
81
|
+
(unless replacement
|
|
82
|
+
;; The public symbol API preserves lexical closure
|
|
83
|
+
;; environments and (macro . FUNCTION) wrappers.
|
|
84
|
+
(setq replacement (byte-compile name))
|
|
85
|
+
(unless (eliscript-cli--bytecode-definition-p replacement)
|
|
86
|
+
(error "cannot prepare Seed bytecode for %s" name))
|
|
87
|
+
(puthash definition replacement compiled))
|
|
88
|
+
(fset name replacement))))))))))))
|
|
89
|
+
(setq eliscript-cli--compiler-bytecompiled t))))
|
|
90
|
+
|
|
14
91
|
(defconst eliscript-cli--usage
|
|
15
92
|
(concat
|
|
16
93
|
"Usage: eliscript [--output FILE] [--source-map] [--portable NAME]\n"
|
|
@@ -80,6 +157,8 @@
|
|
|
80
157
|
,diagnostic-format)
|
|
81
158
|
(eliscript-cli--parse arguments)))
|
|
82
159
|
(setq requested-format diagnostic-format)
|
|
160
|
+
(when (eliscript-cli--large-readable-input-p input)
|
|
161
|
+
(eliscript-cli--byte-compile-loaded-compiler))
|
|
83
162
|
(if source-map
|
|
84
163
|
(if portable-entries
|
|
85
164
|
(eliscript-compile-portable-file-with-source-map
|
|
@@ -103,6 +182,10 @@
|
|
|
103
182
|
(eliscript-diagnostic-condition-message error-data)))
|
|
104
183
|
(kill-emacs 1)))))
|
|
105
184
|
|
|
106
|
-
|
|
185
|
+
;; The script owns these arguments. Leaving them for Emacs makes its normal
|
|
186
|
+
;; startup reopen output paths after compilation and prompt for large files.
|
|
187
|
+
(let ((arguments command-line-args-left))
|
|
188
|
+
(setq command-line-args-left nil)
|
|
189
|
+
(eliscript-cli-main arguments))
|
|
107
190
|
|
|
108
191
|
;;; eliscript-cli.el ends here
|