eliscript 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +135 -0
- package/bin/eliscript +16 -0
- package/bin/eliscript-bootstrap +15 -0
- package/bin/eliscript-build +15 -0
- package/bin/eliscript-check +15 -0
- package/bin/eliscript-eval +15 -0
- package/bin/eliscript-format +15 -0
- package/bin/eliscript-org +10 -0
- package/bin/eliscript-portable +17 -0
- package/bin/eliscript-seed +10 -0
- package/bin/eliscript-seed-build +10 -0
- package/bin/eliscript-watch +15 -0
- package/bootstrap/README.md +100 -0
- package/bootstrap/compiler/analyzer.eli +1426 -0
- package/bootstrap/compiler/compiler.eli +472 -0
- package/bootstrap/compiler/emitter.eli +1745 -0
- package/bootstrap/compiler/expander.eli +2522 -0
- package/bootstrap/compiler/formatter.eli +359 -0
- package/bootstrap/compiler/ir.eli +297 -0
- package/bootstrap/compiler/lower.eli +661 -0
- package/bootstrap/compiler/project.eli +1120 -0
- package/bootstrap/compiler/reader.eli +321 -0
- package/bootstrap/compiler/source-map.eli +165 -0
- package/bootstrap/compiler/symbol.eli +92 -0
- package/bootstrap/compiler/syntax.eli +54 -0
- package/bootstrap/compiler/transient-analysis.eli +825 -0
- package/bootstrap/host/build.mjs +28 -0
- package/bootstrap/host/bun.mjs +282 -0
- package/bootstrap/host/check-cli.mjs +163 -0
- package/bootstrap/host/eliscript-cli.mjs +36 -0
- package/bootstrap/host/evaluation-cli.mjs +401 -0
- package/bootstrap/host/evaluation.mjs +560 -0
- package/bootstrap/host/format-cli.mjs +139 -0
- package/bootstrap/host/project-cli.mjs +295 -0
- package/bootstrap/host/project.mjs +1080 -0
- package/bootstrap/host/watch-cli.mjs +129 -0
- package/bootstrap/host/watch.mjs +267 -0
- package/browser/host.mjs +357 -0
- package/browser/worker.mjs +60 -0
- package/compiler/README.md +118 -0
- package/compiler/eliscript-analyzer.el +716 -0
- package/compiler/eliscript-cli.el +108 -0
- package/compiler/eliscript-diagnostic.el +158 -0
- package/compiler/eliscript-emitter.el +1351 -0
- package/compiler/eliscript-evaluation.el +259 -0
- package/compiler/eliscript-expander.el +1630 -0
- package/compiler/eliscript-form.el +79 -0
- package/compiler/eliscript-ir-emitter.el +1460 -0
- package/compiler/eliscript-ir.el +356 -0
- package/compiler/eliscript-lower.el +463 -0
- package/compiler/eliscript-macro-eval.el +811 -0
- package/compiler/eliscript-parameters.el +324 -0
- package/compiler/eliscript-portable.el +492 -0
- package/compiler/eliscript-project-cli.el +156 -0
- package/compiler/eliscript-project.el +1676 -0
- package/compiler/eliscript-reader.el +421 -0
- package/compiler/eliscript-source-map.el +192 -0
- package/compiler/eliscript-symbol.el +101 -0
- package/compiler/eliscript-transient-analysis.el +817 -0
- package/compiler/eliscript.el +239 -0
- package/dist/bootstrap/analyzer.mjs +968 -0
- package/dist/bootstrap/analyzer.mjs.map +1 -0
- package/dist/bootstrap/compiler.mjs +228 -0
- package/dist/bootstrap/compiler.mjs.map +1 -0
- package/dist/bootstrap/emitter.mjs +1173 -0
- package/dist/bootstrap/emitter.mjs.map +1 -0
- package/dist/bootstrap/expander.mjs +1469 -0
- package/dist/bootstrap/expander.mjs.map +1 -0
- package/dist/bootstrap/formatter.mjs +304 -0
- package/dist/bootstrap/formatter.mjs.map +1 -0
- package/dist/bootstrap/ir.mjs +193 -0
- package/dist/bootstrap/ir.mjs.map +1 -0
- package/dist/bootstrap/lower.mjs +344 -0
- package/dist/bootstrap/lower.mjs.map +1 -0
- package/dist/bootstrap/project.mjs +585 -0
- package/dist/bootstrap/project.mjs.map +1 -0
- package/dist/bootstrap/reader.mjs +259 -0
- package/dist/bootstrap/reader.mjs.map +1 -0
- package/dist/bootstrap/source-map.mjs +154 -0
- package/dist/bootstrap/source-map.mjs.map +1 -0
- package/dist/bootstrap/symbol.mjs +74 -0
- package/dist/bootstrap/symbol.mjs.map +1 -0
- package/dist/bootstrap/syntax.mjs +38 -0
- package/dist/bootstrap/syntax.mjs.map +1 -0
- package/dist/bootstrap/transient-analysis.mjs +660 -0
- package/dist/bootstrap/transient-analysis.mjs.map +1 -0
- package/dist/browser/compiler.js +6491 -0
- package/editor/README.md +83 -0
- package/editor/eliscript-mode.el +878 -0
- package/editor/eliscript-repl.el +501 -0
- package/package.json +163 -0
- package/platform/README.md +48 -0
- package/platform/browser.mjs +204 -0
- package/platform/worker.mjs +166 -0
- package/runtime/README.md +296 -0
- package/runtime/core/collection-internals.mjs +512 -0
- package/runtime/core/collection.mjs +645 -0
- package/runtime/core/data-text.mjs +532 -0
- package/runtime/core/data.mjs +268 -0
- package/runtime/core/identifier.mjs +314 -0
- package/runtime/core/lazy-sequence.mjs +244 -0
- package/runtime/core/list-internals.mjs +18 -0
- package/runtime/core/list.mjs +273 -0
- package/runtime/core/map-internals.mjs +793 -0
- package/runtime/core/map.mjs +394 -0
- package/runtime/core/metadata-internals.mjs +14 -0
- package/runtime/core/metadata.mjs +44 -0
- package/runtime/core/object-impl.mjs +65 -0
- package/runtime/core/object-impl.mjs.map +1 -0
- package/runtime/core/object.mjs +13 -0
- package/runtime/core/order.mjs +234 -0
- package/runtime/core/persistent-kind.mjs +43 -0
- package/runtime/core/protocol-error.mjs +36 -0
- package/runtime/core/protocol-impl.mjs +326 -0
- package/runtime/core/protocol-impl.mjs.map +1 -0
- package/runtime/core/protocol.mjs +14 -0
- package/runtime/core/queue-internals.mjs +27 -0
- package/runtime/core/queue.mjs +238 -0
- package/runtime/core/record.mjs +346 -0
- package/runtime/core/regex.mjs +184 -0
- package/runtime/core/sequence.mjs +632 -0
- package/runtime/core/set-algebra.mjs +287 -0
- package/runtime/core/set-internals.mjs +33 -0
- package/runtime/core/set.mjs +378 -0
- package/runtime/core/sorted-internals.mjs +215 -0
- package/runtime/core/sorted.mjs +598 -0
- package/runtime/core/text-impl.mjs +95 -0
- package/runtime/core/text-impl.mjs.map +1 -0
- package/runtime/core/text.mjs +15 -0
- package/runtime/core/transducer.mjs +668 -0
- package/runtime/core/transient-internals.mjs +38 -0
- package/runtime/core/transient.mjs +53 -0
- package/runtime/core/truth.mjs +3 -0
- package/runtime/core/type.mjs +262 -0
- package/runtime/core/value-internals.mjs +188 -0
- package/runtime/core/value.mjs +93 -0
- package/runtime/core/vector-internals.mjs +102 -0
- package/runtime/core/vector.mjs +951 -0
- package/runtime/literals.mjs +34 -0
- package/runtime/source-mapping.mjs +220 -0
- package/runtime/testing/list.mjs +52 -0
- package/runtime/testing/map.mjs +145 -0
- package/runtime/testing/queue.mjs +49 -0
- package/runtime/testing/set.mjs +61 -0
- package/runtime/testing/sorted.mjs +105 -0
- package/runtime/testing/value.mjs +17 -0
- package/runtime/testing/vector.mjs +102 -0
- package/runtime/worker-value-codec.mjs +565 -0
- package/runtime/worker-value-stream.mjs +786 -0
- package/runtime/worker.mjs +975 -0
- package/stdlib/README.md +774 -0
- package/stdlib/bit.eli +36 -0
- package/stdlib/core/collection.eli +134 -0
- package/stdlib/core/data-text.eli +16 -0
- package/stdlib/core/data.eli +306 -0
- package/stdlib/core/identifier.eli +32 -0
- package/stdlib/core/lazy-sequence.eli +63 -0
- package/stdlib/core/metadata.eli +20 -0
- package/stdlib/core/object.eli +89 -0
- package/stdlib/core/order.eli +133 -0
- package/stdlib/core/protocol.eli +387 -0
- package/stdlib/core/record.eli +16 -0
- package/stdlib/core/regex.eli +17 -0
- package/stdlib/core/seq.eli +701 -0
- package/stdlib/core/set.eli +312 -0
- package/stdlib/core/sorted.eli +53 -0
- package/stdlib/core/text.eli +103 -0
- package/stdlib/core/transducer.eli +59 -0
- package/stdlib/core/transient.eli +24 -0
- package/stdlib/core/type.eli +19 -0
- package/stdlib/core/walk.eli +195 -0
- package/stdlib/core/zipper.eli +508 -0
- package/stdlib/data-text.eli +1092 -0
- package/stdlib/data.eli +42 -0
- package/stdlib/deferred.eli +70 -0
- package/stdlib/function.eli +120 -0
- package/stdlib/hierarchy.eli +245 -0
- package/stdlib/identifier.eli +147 -0
- package/stdlib/interop/js.eli +616 -0
- package/stdlib/json.eli +870 -0
- package/stdlib/metadata.eli +56 -0
- package/stdlib/multimethod.eli +464 -0
- package/stdlib/numeric.eli +193 -0
- package/stdlib/object.eli +96 -0
- package/stdlib/persistent-list.eli +145 -0
- package/stdlib/persistent-map.eli +724 -0
- package/stdlib/persistent-queue.eli +32 -0
- package/stdlib/persistent-set.eli +236 -0
- package/stdlib/persistent-vector.eli +342 -0
- package/stdlib/result.eli +141 -0
- package/stdlib/sequence.eli +106 -0
- package/stdlib/state/atom.eli +265 -0
- package/stdlib/text.eli +88 -0
- package/stdlib/value.eli +325 -0
package/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/pages/assets/eliscript-logo-light.png">
|
|
4
|
+
<img src="docs/pages/assets/eliscript-logo.png" width="144" alt="Eliscript logo">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
# Eliscript
|
|
9
|
+
|
|
10
|
+
Eliscript is an Emacs Lisp-flavored language that compiles to modern
|
|
11
|
+
JavaScript. The seed compiler runs in plain Emacs, emits standard ECMAScript
|
|
12
|
+
modules, and bootstraps a compiler written in Eliscript itself.
|
|
13
|
+
|
|
14
|
+
**[Documentation](https://liuchong.org/eliscript/)** ·
|
|
15
|
+
[Core documentation](docs/README.md) ·
|
|
16
|
+
[Getting started](docs/getting-started.md) ·
|
|
17
|
+
[Language reference](docs/language-reference.md) ·
|
|
18
|
+
[Library API](https://liuchong.org/eliscript/pages/api.html) ·
|
|
19
|
+
[Playground](https://liuchong.org/eliscript/pages/playground.html) ·
|
|
20
|
+
[Roadmap](specs/0040-maturity-roadmap.md) ·
|
|
21
|
+
[Acceptance evidence](acceptance/README.md) ·
|
|
22
|
+
[Specifications](specs/README.md)
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
Building from source needs Emacs 29 or newer and Bun 1.4 or newer. The
|
|
27
|
+
compiled compiler ships in the release tarball, so a consumer needs only Node
|
|
28
|
+
24 or Bun; the package is prepared and rehearsed, and the first publication is
|
|
29
|
+
pending.
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
bun install --frozen-lockfile
|
|
33
|
+
./bin/eliscript --output dist/basic.mjs examples/basic/main.eli
|
|
34
|
+
bun run dist/basic.mjs
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
A whole project compiles as one graph, with `--source-map` for an external
|
|
38
|
+
Source Map v3:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
./bin/eliscript-build --root . --out-dir dist/project \
|
|
42
|
+
examples/stdlib-cli/main.eli
|
|
43
|
+
bun run dist/project/examples/stdlib-cli/main.mjs
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The daily commands are `./bin/eliscript-check` for type and protocol checks,
|
|
47
|
+
`./bin/eliscript-format` for canonical formatting, `./bin/eliscript-eval` for
|
|
48
|
+
evaluation, `./bin/eliscript-watch` for rebuilds, and `./bin/eliscript-org` for
|
|
49
|
+
Org sources. Each has a documented page in the
|
|
50
|
+
[documentation](docs/getting-started.md).
|
|
51
|
+
|
|
52
|
+
## What Works Today
|
|
53
|
+
|
|
54
|
+
| Area | State |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| Compiler | Emacs Lisp seed, reproducible self-hosted compiler, deterministic formatter, versioned canonical IR, Source Maps that name `.eli` files |
|
|
57
|
+
| Language | Tail calls, macros, modules, protocols, records, `deftype`/`reify`, `case`/`condp`, multi-arity named, anonymous, async, and portable functions |
|
|
58
|
+
| Data | Persistent List, Vector, Map, Set, and Queue with value equality; transients; lazy sequences; transducers |
|
|
59
|
+
| Runtime | Host-free runtime semantics, frozen regular expressions, a long-lived Emacs-to-JavaScript worker |
|
|
60
|
+
| Browser | An in-memory multi-file compile host, a module worker, and a compiler bundled for the browser — the [playground](https://liuchong.org/eliscript/pages/playground.html) compiles and runs Eliscript in the page |
|
|
61
|
+
| Editor | [`eliscript-mode`](editor/README.md) and an evaluation REPL |
|
|
62
|
+
| Applications | The [proving-ground site](https://liuchong.org/eliscript/examples/dogfood/_site/) and the packaged Action built from it, plus React, Org, and Vite probes as replaceable application evidence |
|
|
63
|
+
|
|
64
|
+
## Project Status
|
|
65
|
+
|
|
66
|
+
The retained core acceptance audit records **35 of 35 mandatory criteria
|
|
67
|
+
passing, 0 incomplete, 0 failed**, with all five evidence groups complete and no
|
|
68
|
+
blocking defects: [`acceptance/report.md`](acceptance/report.md). Implementation
|
|
69
|
+
units through **M12: Reliability, Security, and Performance** are complete, and
|
|
70
|
+
core stabilization and the retained audit are done. Progress is reported from
|
|
71
|
+
acceptance units rather than from elapsed time, in
|
|
72
|
+
[Evidence-derived maturity progress](specs/0122-evidence-derived-maturity-progress.md).
|
|
73
|
+
|
|
74
|
+
Known gaps, stated rather than implied:
|
|
75
|
+
|
|
76
|
+
- The Linux x64 compatibility cells are optional in the contract and carry no
|
|
77
|
+
retained reports; macOS arm64 is the required acceptance platform.
|
|
78
|
+
- The proving-ground specifications are marked `In progress`: the application is
|
|
79
|
+
exercised by its tests and published, and its own acceptance set is not
|
|
80
|
+
complete.
|
|
81
|
+
- Publication is prepared and not performed: no tag, no registry release, and no
|
|
82
|
+
Marketplace listing exists yet.
|
|
83
|
+
|
|
84
|
+
## Contracts
|
|
85
|
+
|
|
86
|
+
The published surface and the compatibility it must keep are recorded as
|
|
87
|
+
machine-checked registries: [`contracts/public-surface.json`](contracts/public-surface.json)
|
|
88
|
+
([0044](specs/0044-public-surface-registry.md)),
|
|
89
|
+
[`contracts/compatibility-matrix.json`](contracts/compatibility-matrix.json)
|
|
90
|
+
([0045](specs/0045-continuous-compatibility-matrix.md)), and the retained
|
|
91
|
+
baseline in
|
|
92
|
+
[`contracts/compatibility-baseline.json`](contracts/compatibility-baseline.json)
|
|
93
|
+
([0046](specs/0046-m7-compatibility-baseline.md)).
|
|
94
|
+
|
|
95
|
+
## Repository Guide
|
|
96
|
+
|
|
97
|
+
| Path | Purpose |
|
|
98
|
+
| --- | --- |
|
|
99
|
+
| [`bin/`](bin/) | Command-line entry points |
|
|
100
|
+
| [`compiler/`](compiler/README.md) | Emacs Lisp seed compiler |
|
|
101
|
+
| [`bootstrap/`](bootstrap/README.md) | Compiler implementation written in Eliscript |
|
|
102
|
+
| [`runtime/`](runtime/README.md) | Value, protocol, collection, and worker runtime |
|
|
103
|
+
| [`stdlib/`](stdlib/README.md) | Portable Eliscript standard library |
|
|
104
|
+
| [`platform/`](platform/README.md) | Host capability packages for Node, Bun, and the browser |
|
|
105
|
+
| [`browser/`](browser/) | In-memory compile host and its module worker |
|
|
106
|
+
| [`editor/`](editor/README.md) | Emacs major mode and editor integration |
|
|
107
|
+
| [`examples/`](examples/README.md) | Language, project, browser, and application probes |
|
|
108
|
+
| [`docs/`](docs/README.md) | Documentation source and the published site |
|
|
109
|
+
| [`specs/`](specs/README.md) | Numbered design contracts and the specification catalog |
|
|
110
|
+
| [`contracts/`](contracts/) | Public surface, compatibility, and baseline registries |
|
|
111
|
+
| [`acceptance/`](acceptance/README.md) | Retained audits, platform records, and the final artifact |
|
|
112
|
+
| [`tests/`](tests/README.md) | ERT, Bun, fixtures, and conformance evidence |
|
|
113
|
+
| [`benchmarks/`](benchmarks/README.md) | Reviewed performance evidence and host fingerprints |
|
|
114
|
+
| [`tools/`](tools/README.md) | Build, verification, and integration tooling |
|
|
115
|
+
|
|
116
|
+
## Development
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
make byte-compile # Emacs Lisp with warnings as errors
|
|
120
|
+
make test-core # contracts and the framework-neutral suite
|
|
121
|
+
make test-applications # maintained application consumers
|
|
122
|
+
make check-browsers # three engines against the generated site
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`bun run test` runs both test partitions. Generated output under `dist/` is
|
|
126
|
+
never committed; contract checks compare it against its sources instead.
|
|
127
|
+
|
|
128
|
+
[Contributing](docs/contributing.md) describes the workflow, and
|
|
129
|
+
[`docs/README.md`](docs/README.md) is the documentation hub.
|
|
130
|
+
|
|
131
|
+
## License
|
|
132
|
+
|
|
133
|
+
GPL-3.0-or-later. The compiler and standard library ship as source alongside
|
|
134
|
+
the generated output they produce, which is the preferred form for
|
|
135
|
+
modification.
|
package/bin/eliscript
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
5
|
+
PROJECT_DIR=$(dirname -- "$SCRIPT_DIR")
|
|
6
|
+
MODULE_DIR=${ELISCRIPT_BOOTSTRAP_MODULE_DIR:-"$PROJECT_DIR/dist/bootstrap"}
|
|
7
|
+
: "${ELISCRIPT_JS_RUNTIME:=bun}"
|
|
8
|
+
|
|
9
|
+
if [ ! -f "$MODULE_DIR/compiler.mjs" ]; then
|
|
10
|
+
ELISCRIPT_BOOTSTRAP_OUT_DIR="$MODULE_DIR" \
|
|
11
|
+
"$PROJECT_DIR/bin/eliscript-bootstrap"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
export ELISCRIPT_BOOTSTRAP_MODULE_DIR="$MODULE_DIR"
|
|
15
|
+
export ELISCRIPT_COMMAND_NAME=eliscript
|
|
16
|
+
exec "$ELISCRIPT_JS_RUNTIME" "$PROJECT_DIR/bootstrap/host/bun.mjs" "$@"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
5
|
+
PROJECT_DIR=$(dirname -- "$SCRIPT_DIR")
|
|
6
|
+
OUTPUT_DIR=${ELISCRIPT_BOOTSTRAP_OUT_DIR:-"$PROJECT_DIR/dist/bootstrap"}
|
|
7
|
+
|
|
8
|
+
mkdir -p "$OUTPUT_DIR"
|
|
9
|
+
|
|
10
|
+
for module in symbol syntax reader formatter expander transient-analysis analyzer ir lower source-map emitter project compiler; do
|
|
11
|
+
"$PROJECT_DIR/bin/eliscript-seed" \
|
|
12
|
+
--source-map \
|
|
13
|
+
--output "$OUTPUT_DIR/$module.mjs" \
|
|
14
|
+
"$PROJECT_DIR/bootstrap/compiler/$module.eli"
|
|
15
|
+
done
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
5
|
+
PROJECT_DIR=$(dirname -- "$SCRIPT_DIR")
|
|
6
|
+
MODULE_DIR=${ELISCRIPT_BOOTSTRAP_MODULE_DIR:-"$PROJECT_DIR/dist/bootstrap"}
|
|
7
|
+
: "${ELISCRIPT_JS_RUNTIME:=bun}"
|
|
8
|
+
|
|
9
|
+
if [ ! -f "$MODULE_DIR/compiler.mjs" ]; then
|
|
10
|
+
ELISCRIPT_BOOTSTRAP_OUT_DIR="$MODULE_DIR" \
|
|
11
|
+
"$PROJECT_DIR/bin/eliscript-bootstrap"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
export ELISCRIPT_BOOTSTRAP_MODULE_DIR="$MODULE_DIR"
|
|
15
|
+
exec "$ELISCRIPT_JS_RUNTIME" "$PROJECT_DIR/bootstrap/host/project-cli.mjs" "$@"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
5
|
+
PROJECT_DIR=$(dirname -- "$SCRIPT_DIR")
|
|
6
|
+
MODULE_DIR=${ELISCRIPT_BOOTSTRAP_MODULE_DIR:-"$PROJECT_DIR/dist/bootstrap"}
|
|
7
|
+
: "${ELISCRIPT_JS_RUNTIME:=bun}"
|
|
8
|
+
|
|
9
|
+
if [ ! -f "$MODULE_DIR/compiler.mjs" ]; then
|
|
10
|
+
ELISCRIPT_BOOTSTRAP_OUT_DIR="$MODULE_DIR" \
|
|
11
|
+
"$PROJECT_DIR/bin/eliscript-bootstrap"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
export ELISCRIPT_BOOTSTRAP_MODULE_DIR="$MODULE_DIR"
|
|
15
|
+
exec "$ELISCRIPT_JS_RUNTIME" "$PROJECT_DIR/bootstrap/host/check-cli.mjs" "$@"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
5
|
+
PROJECT_DIR=$(dirname -- "$SCRIPT_DIR")
|
|
6
|
+
MODULE_DIR=${ELISCRIPT_BOOTSTRAP_MODULE_DIR:-"$PROJECT_DIR/dist/bootstrap"}
|
|
7
|
+
: "${ELISCRIPT_JS_RUNTIME:=bun}"
|
|
8
|
+
|
|
9
|
+
if [ ! -f "$MODULE_DIR/compiler.mjs" ]; then
|
|
10
|
+
ELISCRIPT_BOOTSTRAP_OUT_DIR="$MODULE_DIR" \
|
|
11
|
+
"$PROJECT_DIR/bin/eliscript-bootstrap"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
export ELISCRIPT_BOOTSTRAP_MODULE_DIR="$MODULE_DIR"
|
|
15
|
+
exec "$ELISCRIPT_JS_RUNTIME" "$PROJECT_DIR/bootstrap/host/evaluation-cli.mjs" "$@"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
5
|
+
PROJECT_DIR=$(dirname -- "$SCRIPT_DIR")
|
|
6
|
+
MODULE_DIR=${ELISCRIPT_BOOTSTRAP_MODULE_DIR:-"$PROJECT_DIR/dist/bootstrap"}
|
|
7
|
+
: "${ELISCRIPT_JS_RUNTIME:=bun}"
|
|
8
|
+
|
|
9
|
+
if [ ! -f "$MODULE_DIR/compiler.mjs" ]; then
|
|
10
|
+
ELISCRIPT_BOOTSTRAP_OUT_DIR="$MODULE_DIR" \
|
|
11
|
+
"$PROJECT_DIR/bin/eliscript-bootstrap"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
export ELISCRIPT_BOOTSTRAP_MODULE_DIR="$MODULE_DIR"
|
|
15
|
+
exec "$ELISCRIPT_JS_RUNTIME" "$PROJECT_DIR/bootstrap/host/format-cli.mjs" "$@"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
5
|
+
PROJECT_DIR=$(dirname -- "$SCRIPT_DIR")
|
|
6
|
+
: "${BUN:=bun}"
|
|
7
|
+
: "${ELISCRIPT_BOOTSTRAP_MODULE_DIR:=$PROJECT_DIR/dist/bootstrap}"
|
|
8
|
+
|
|
9
|
+
if [ ! -f "$ELISCRIPT_BOOTSTRAP_MODULE_DIR/compiler.mjs" ]; then
|
|
10
|
+
printf '%s\n' \
|
|
11
|
+
'eliscript: portable compiler is missing; run bun run build:bootstrap first' \
|
|
12
|
+
>&2
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
export ELISCRIPT_BOOTSTRAP_MODULE_DIR
|
|
17
|
+
exec "$BUN" "$PROJECT_DIR/bootstrap/host/bun.mjs" "$@"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
5
|
+
PROJECT_DIR=$(dirname -- "$SCRIPT_DIR")
|
|
6
|
+
MODULE_DIR=${ELISCRIPT_BOOTSTRAP_MODULE_DIR:-"$PROJECT_DIR/dist/bootstrap"}
|
|
7
|
+
: "${ELISCRIPT_JS_RUNTIME:=bun}"
|
|
8
|
+
|
|
9
|
+
if [ ! -f "$MODULE_DIR/compiler.mjs" ]; then
|
|
10
|
+
ELISCRIPT_BOOTSTRAP_OUT_DIR="$MODULE_DIR" \
|
|
11
|
+
"$PROJECT_DIR/bin/eliscript-bootstrap"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
export ELISCRIPT_BOOTSTRAP_MODULE_DIR="$MODULE_DIR"
|
|
15
|
+
exec "$ELISCRIPT_JS_RUNTIME" "$PROJECT_DIR/bootstrap/host/watch-cli.mjs" "$@"
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Bootstrap Compiler
|
|
2
|
+
|
|
3
|
+
[Project README](../README.md) | [Seed compiler](../compiler/README.md) |
|
|
4
|
+
[Specifications](../specs/README.md)
|
|
5
|
+
|
|
6
|
+
This directory contains compiler modules written in Eliscript. The Emacs Lisp
|
|
7
|
+
seed compiler builds them into ESM until the portable implementation can
|
|
8
|
+
compile itself.
|
|
9
|
+
|
|
10
|
+
## Dependency Order
|
|
11
|
+
|
|
12
|
+
The bootstrap grows along this dependency order:
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
symbol semantics (implemented)
|
|
16
|
+
-> syntax data model (implemented)
|
|
17
|
+
-> reader (implemented)
|
|
18
|
+
-> concrete-syntax formatter (implemented)
|
|
19
|
+
-> macro expander (implemented)
|
|
20
|
+
-> lexical analyzer (implemented)
|
|
21
|
+
-> IR data model (implemented)
|
|
22
|
+
-> IR lowering (implemented)
|
|
23
|
+
-> ESM and Source Map emitter (implemented)
|
|
24
|
+
-> project graph, portable closure, and build-report policy (implemented)
|
|
25
|
+
-> compiler driver (implemented)
|
|
26
|
+
-> reproducible self-compilation (implemented)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Modules
|
|
30
|
+
|
|
31
|
+
`compiler/symbol.eli` owns deterministic mapping from Lisp-style names to
|
|
32
|
+
ECMAScript identifiers. `compiler/syntax.eli` defines serializable syntax nodes
|
|
33
|
+
and source spans. `compiler/reader.eli` parses the portable source grammar into
|
|
34
|
+
that representation. `compiler/expander.eli` evaluates the deterministic macro
|
|
35
|
+
subset without host `eval`, then `compiler/analyzer.eli` validates lexical
|
|
36
|
+
scope and special forms. `compiler/ir.eli` defines JSON-safe IR nodes plus the
|
|
37
|
+
closed `eliscript-ir` v1 canonical serialization boundary, and
|
|
38
|
+
`compiler/lower.eli` lowers analyzed syntax across the complete language
|
|
39
|
+
surface. `compiler/emitter.eli` formats portable IR through explicit text and
|
|
40
|
+
mapping fragments, while `compiler/source-map.eli` encodes those marks as
|
|
41
|
+
Source Map v3. The generated pipeline can process and emit every current
|
|
42
|
+
bootstrap module, including its own sources. `compiler/compiler.eli` composes
|
|
43
|
+
the complete in-memory pipeline without filesystem dependencies and owns the
|
|
44
|
+
versioned evaluation request, interactive-input, form-classification, binding,
|
|
45
|
+
export, and macro descriptors used by persistent evaluation.
|
|
46
|
+
`compiler/formatter.eli` separately owns comment-preserving concrete syntax,
|
|
47
|
+
fixed layout, and canonical source text without using emitter or application
|
|
48
|
+
formatting behavior.
|
|
49
|
+
`compiler/project.eli` owns the versioned single-file/project operation
|
|
50
|
+
boundary, single-entry and multi-entry request identity, cycle-safe dependency
|
|
51
|
+
traversal, portable-name fixed points, and versioned build-report normalization
|
|
52
|
+
and cache-status policy.
|
|
53
|
+
`host/build.mjs` dispatches normalized operations without defining compiler
|
|
54
|
+
semantics.
|
|
55
|
+
`host/project.mjs` supplies the replaceable filesystem, path, artifact, and
|
|
56
|
+
timing boundary while using those generated operations for real multi-module
|
|
57
|
+
builds.
|
|
58
|
+
`host/evaluation.mjs` owns one persistent temporary namespace, canonical value
|
|
59
|
+
printing, output framing, Source Map failure normalization, revision commits,
|
|
60
|
+
and cleanup. `host/evaluation-cli.mjs` exposes one-shot, NDJSON, and persistent
|
|
61
|
+
terminal REPL modes through the public `eliscript-eval` command. Terminal
|
|
62
|
+
commands and presentation remain host behavior; multiline completeness remains
|
|
63
|
+
compiler-owned reader behavior.
|
|
64
|
+
`host/watch.mjs` owns canonical content snapshots, sorted project invalidation
|
|
65
|
+
events, polling lifecycle, and the versioned `eliscript-watch-event` boundary.
|
|
66
|
+
`host/watch-cli.mjs` exposes that boundary without a framework, bundler, or
|
|
67
|
+
development server.
|
|
68
|
+
|
|
69
|
+
## Build
|
|
70
|
+
|
|
71
|
+
Build the current bootstrap modules with the seed compiler:
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
bun run build:bootstrap
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The normal command automatically establishes that seed build when needed, then
|
|
78
|
+
compiles through the generated compiler under Bun or Node:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
./bin/eliscript --output dist/program.mjs source/program.eli
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Fixed-point Evidence
|
|
85
|
+
|
|
86
|
+
Generated files are written below `dist/bootstrap/` and are not source
|
|
87
|
+
artifacts. Shared fixtures cover symbol behavior, reader syntax, macro
|
|
88
|
+
expansion, lexical analysis, all 57 IR node kinds, direct ESM emission, and
|
|
89
|
+
Source Map v3. Oracles compare complete syntax and IR trees, spans, properties,
|
|
90
|
+
acceptance, exact diagnostics, JavaScript bytes, and parsed source maps between
|
|
91
|
+
the seed and generated implementations. Canonical IR round trips all 57 node
|
|
92
|
+
kinds and produces identical bytes under Bun and Node. Repeated builds must be
|
|
93
|
+
byte-identical.
|
|
94
|
+
|
|
95
|
+
Generation 1 is self-hosting. The conformance suite builds it with the seed,
|
|
96
|
+
uses it to build Generation 2, then uses Generation 2 to build Generation 3.
|
|
97
|
+
All thirteen ESM modules and Source Maps are byte-identical across those
|
|
98
|
+
generations. Formatter corpus tests additionally require canonical source to
|
|
99
|
+
be byte-idempotent and original/formatted core sources to emit identical ESM.
|
|
100
|
+
The Emacs Lisp seed remains the readable bootstrap and reference implementation.
|