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
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
;;; eliscript-repl.el --- Persistent evaluation for eliscript-mode -*- lexical-binding: t; -*-
|
|
2
|
+
|
|
3
|
+
;; Author: 刘冲 <mail@liuchong.dev>
|
|
4
|
+
;; Maintainer: 刘冲 <mail@liuchong.dev>
|
|
5
|
+
;; Version: 0.0.1
|
|
6
|
+
;; Package-Requires: ((emacs "29.1"))
|
|
7
|
+
;; Keywords: languages, lisp
|
|
8
|
+
;; URL: https://github.com/liuchong/eliscript
|
|
9
|
+
|
|
10
|
+
;;; Commentary:
|
|
11
|
+
|
|
12
|
+
;; Project-scoped NDJSON evaluation sessions for the maintained major mode.
|
|
13
|
+
|
|
14
|
+
;;; Code:
|
|
15
|
+
|
|
16
|
+
(require 'cl-lib)
|
|
17
|
+
(require 'compile)
|
|
18
|
+
(require 'json)
|
|
19
|
+
(require 'seq)
|
|
20
|
+
(require 'subr-x)
|
|
21
|
+
|
|
22
|
+
(declare-function eliscript-mode-project-root "eliscript-mode")
|
|
23
|
+
(declare-function eliscript-mode--current-definition-start "eliscript-mode")
|
|
24
|
+
(defvar eliscript-mode-eval-command)
|
|
25
|
+
|
|
26
|
+
(defconst eliscript-repl--result-format "eliscript-evaluation-result")
|
|
27
|
+
(defconst eliscript-repl--result-version 1)
|
|
28
|
+
|
|
29
|
+
(defconst eliscript-repl--compilation-regexp
|
|
30
|
+
'(eliscript-evaluation
|
|
31
|
+
"^eliscript-eval: \\(.+\\):\\([0-9]+\\):\\([0-9]+\\): " 1 2 3)
|
|
32
|
+
"Compilation regexp for located evaluation diagnostics.")
|
|
33
|
+
|
|
34
|
+
(add-to-list 'compilation-error-regexp-alist-alist
|
|
35
|
+
eliscript-repl--compilation-regexp)
|
|
36
|
+
|
|
37
|
+
(define-compilation-mode eliscript-repl-mode "Eliscript-REPL"
|
|
38
|
+
"Compilation-derived mode for Eliscript evaluation values and failures."
|
|
39
|
+
(setq-local compilation-error-regexp-alist '(eliscript-evaluation)))
|
|
40
|
+
|
|
41
|
+
(cl-defstruct (eliscript-repl--pending
|
|
42
|
+
(:constructor eliscript-repl--pending-create))
|
|
43
|
+
id
|
|
44
|
+
payload
|
|
45
|
+
callback
|
|
46
|
+
source-buffer
|
|
47
|
+
internal)
|
|
48
|
+
|
|
49
|
+
(cl-defstruct (eliscript-repl--session
|
|
50
|
+
(:constructor eliscript-repl--session-create))
|
|
51
|
+
root
|
|
52
|
+
process
|
|
53
|
+
process-buffer
|
|
54
|
+
error-buffer
|
|
55
|
+
fragment
|
|
56
|
+
pending
|
|
57
|
+
next-id
|
|
58
|
+
generation
|
|
59
|
+
state
|
|
60
|
+
stopped
|
|
61
|
+
restart-failures
|
|
62
|
+
queue
|
|
63
|
+
recovery
|
|
64
|
+
result-buffer)
|
|
65
|
+
|
|
66
|
+
(defvar eliscript-repl--sessions (make-hash-table :test #'equal))
|
|
67
|
+
|
|
68
|
+
(defun eliscript-repl--canonical-root (&optional directory)
|
|
69
|
+
"Return the canonical session root for DIRECTORY or the current buffer."
|
|
70
|
+
(file-name-as-directory
|
|
71
|
+
(expand-file-name
|
|
72
|
+
(or (eliscript-mode-project-root directory)
|
|
73
|
+
(and buffer-file-name (file-name-directory buffer-file-name))
|
|
74
|
+
default-directory))))
|
|
75
|
+
|
|
76
|
+
(defun eliscript-repl--program ()
|
|
77
|
+
"Resolve and validate `eliscript-mode-eval-command'."
|
|
78
|
+
(unless (and (consp eliscript-mode-eval-command)
|
|
79
|
+
(seq-every-p #'stringp eliscript-mode-eval-command)
|
|
80
|
+
(not (string-empty-p (car eliscript-mode-eval-command))))
|
|
81
|
+
(signal 'eliscript-mode-error
|
|
82
|
+
'("eliscript-mode-eval-command must be non-empty strings")))
|
|
83
|
+
(let* ((configured (car eliscript-mode-eval-command))
|
|
84
|
+
(program (if (file-name-absolute-p configured)
|
|
85
|
+
(and (file-executable-p configured) configured)
|
|
86
|
+
(executable-find configured))))
|
|
87
|
+
(or program
|
|
88
|
+
(signal 'eliscript-mode-error
|
|
89
|
+
(list (format "evaluator executable not found: %s"
|
|
90
|
+
configured))))))
|
|
91
|
+
|
|
92
|
+
(defun eliscript-repl--new-session (root)
|
|
93
|
+
"Create and register an inactive evaluation session for ROOT."
|
|
94
|
+
(let ((session
|
|
95
|
+
(eliscript-repl--session-create
|
|
96
|
+
:root root
|
|
97
|
+
:fragment ""
|
|
98
|
+
:pending (make-hash-table :test #'eql)
|
|
99
|
+
:next-id 0
|
|
100
|
+
:generation 0
|
|
101
|
+
:state 'inactive
|
|
102
|
+
:stopped nil
|
|
103
|
+
:restart-failures 0
|
|
104
|
+
:queue nil
|
|
105
|
+
:recovery nil)))
|
|
106
|
+
(puthash root session eliscript-repl--sessions)
|
|
107
|
+
session))
|
|
108
|
+
|
|
109
|
+
(defun eliscript-repl--session (&optional root)
|
|
110
|
+
"Return the project session for ROOT, creating it when necessary."
|
|
111
|
+
(let ((key (or root (eliscript-repl--canonical-root))))
|
|
112
|
+
(or (gethash key eliscript-repl--sessions)
|
|
113
|
+
(eliscript-repl--new-session key))))
|
|
114
|
+
|
|
115
|
+
(defun eliscript-repl--result-buffer (session)
|
|
116
|
+
"Return the evaluation result buffer owned by SESSION."
|
|
117
|
+
(or (and (buffer-live-p (eliscript-repl--session-result-buffer session))
|
|
118
|
+
(eliscript-repl--session-result-buffer session))
|
|
119
|
+
(let* ((root (directory-file-name (eliscript-repl--session-root session)))
|
|
120
|
+
(name (format "*Eliscript REPL: %s*" (file-name-nondirectory root)))
|
|
121
|
+
(buffer (get-buffer-create name)))
|
|
122
|
+
(with-current-buffer buffer
|
|
123
|
+
(unless (derived-mode-p 'eliscript-repl-mode)
|
|
124
|
+
(eliscript-repl-mode))
|
|
125
|
+
(setq-local default-directory (eliscript-repl--session-root session)))
|
|
126
|
+
(setf (eliscript-repl--session-result-buffer session) buffer)
|
|
127
|
+
buffer)))
|
|
128
|
+
|
|
129
|
+
(defun eliscript-repl--diagnostic-position (diagnostic)
|
|
130
|
+
"Return FILE, LINE, and COLUMN from structured DIAGNOSTIC."
|
|
131
|
+
(let* ((location (alist-get 'location diagnostic))
|
|
132
|
+
(start (and (listp location) (alist-get 'start location)))
|
|
133
|
+
(file (and (listp location) (alist-get 'file location)))
|
|
134
|
+
(line (or (and (listp start) (alist-get 'line start))
|
|
135
|
+
(and (listp location) (alist-get 'line location))
|
|
136
|
+
1))
|
|
137
|
+
(column (or (and (listp start) (alist-get 'column start))
|
|
138
|
+
(and (listp location) (alist-get 'column location))
|
|
139
|
+
1)))
|
|
140
|
+
(and (stringp file) (list file line column))))
|
|
141
|
+
|
|
142
|
+
(defun eliscript-repl--insert-result (session result)
|
|
143
|
+
"Append structured RESULT to SESSION's result buffer."
|
|
144
|
+
(let ((buffer (eliscript-repl--result-buffer session))
|
|
145
|
+
(inhibit-read-only t)
|
|
146
|
+
(status (alist-get 'status result))
|
|
147
|
+
(operation (alist-get 'operation result)))
|
|
148
|
+
(with-current-buffer buffer
|
|
149
|
+
(goto-char (point-max))
|
|
150
|
+
(insert (format "\n[%s #%s revision %s]\n"
|
|
151
|
+
operation
|
|
152
|
+
(or (alist-get 'id result) "-")
|
|
153
|
+
(or (alist-get 'revision result) 0)))
|
|
154
|
+
(when-let* ((stdout (alist-get 'stdout result))
|
|
155
|
+
((not (string-empty-p stdout))))
|
|
156
|
+
(insert stdout)
|
|
157
|
+
(unless (string-suffix-p "\n" stdout) (insert "\n")))
|
|
158
|
+
(if (string-equal status "ok")
|
|
159
|
+
(let ((kind (alist-get 'kind result)))
|
|
160
|
+
(cond
|
|
161
|
+
((and (alist-get 'hasValue result)
|
|
162
|
+
(stringp (alist-get 'value result)))
|
|
163
|
+
(insert (alist-get 'value result) "\n"))
|
|
164
|
+
((string-equal kind "module")
|
|
165
|
+
(insert (format "loaded %d bindings\n"
|
|
166
|
+
(length (alist-get 'bindings result)))))
|
|
167
|
+
((string-equal kind "reset") (insert "session reset\n"))
|
|
168
|
+
((string-equal kind "capabilities") (insert "session ready\n"))))
|
|
169
|
+
(let* ((diagnostic (alist-get 'diagnostic result))
|
|
170
|
+
(position (eliscript-repl--diagnostic-position diagnostic))
|
|
171
|
+
(message (or (alist-get 'message diagnostic)
|
|
172
|
+
"evaluation failed")))
|
|
173
|
+
(if position
|
|
174
|
+
(insert (format "eliscript-eval: %s:%d:%d: %s\n"
|
|
175
|
+
(nth 0 position) (nth 1 position)
|
|
176
|
+
(nth 2 position) message))
|
|
177
|
+
(insert (format "eliscript-eval: %s\n" message)))))
|
|
178
|
+
(goto-char (point-max)))
|
|
179
|
+
(if (string-equal status "ok")
|
|
180
|
+
(when-let* ((value (alist-get 'value result)))
|
|
181
|
+
(message "Eliscript => %s" value))
|
|
182
|
+
(setq next-error-last-buffer buffer)
|
|
183
|
+
(display-buffer buffer))))
|
|
184
|
+
|
|
185
|
+
(defun eliscript-repl--synthetic-restart-result (pending revision)
|
|
186
|
+
"Return a restart failure result for PENDING at REVISION."
|
|
187
|
+
`((format . ,eliscript-repl--result-format)
|
|
188
|
+
(version . ,eliscript-repl--result-version)
|
|
189
|
+
(id . ,(eliscript-repl--pending-id pending))
|
|
190
|
+
(operation . ,(alist-get 'operation
|
|
191
|
+
(eliscript-repl--pending-payload pending)))
|
|
192
|
+
(revision . ,revision)
|
|
193
|
+
(status . "error")
|
|
194
|
+
(diagnostic
|
|
195
|
+
(format . "eliscript-diagnostic")
|
|
196
|
+
(version . 1)
|
|
197
|
+
(code . "ELI-E0003")
|
|
198
|
+
(severity . "error")
|
|
199
|
+
(phase . "evaluation-session")
|
|
200
|
+
(message . "evaluation process restarted before acknowledging the request"))))
|
|
201
|
+
|
|
202
|
+
(defun eliscript-repl--remember-result (session pending result)
|
|
203
|
+
"Update SESSION recovery state from acknowledged PENDING and RESULT."
|
|
204
|
+
(unless (or (eliscript-repl--pending-internal pending)
|
|
205
|
+
(not (string-equal (alist-get 'status result) "ok")))
|
|
206
|
+
(let ((operation (alist-get 'operation result))
|
|
207
|
+
(kind (alist-get 'kind result))
|
|
208
|
+
(payload (copy-tree (eliscript-repl--pending-payload pending))))
|
|
209
|
+
(setf (alist-get 'id payload) nil)
|
|
210
|
+
(cond
|
|
211
|
+
((string-equal operation "load")
|
|
212
|
+
(setf (eliscript-repl--session-recovery session)
|
|
213
|
+
(list (cons nil payload))))
|
|
214
|
+
((and (string-equal operation "evaluate")
|
|
215
|
+
(string-equal kind "definition"))
|
|
216
|
+
(let ((binding (alist-get 'binding result)))
|
|
217
|
+
(setf (eliscript-repl--session-recovery session)
|
|
218
|
+
(append
|
|
219
|
+
(cl-remove binding
|
|
220
|
+
(eliscript-repl--session-recovery session)
|
|
221
|
+
:key #'car :test #'equal)
|
|
222
|
+
(list (cons binding payload))))))
|
|
223
|
+
((string-equal operation "reset")
|
|
224
|
+
(setf (eliscript-repl--session-recovery session) nil))))))
|
|
225
|
+
|
|
226
|
+
(defun eliscript-repl--valid-result-p (result)
|
|
227
|
+
"Return non-nil when RESULT has the supported protocol identity."
|
|
228
|
+
(and (listp result)
|
|
229
|
+
(string-equal (alist-get 'format result) eliscript-repl--result-format)
|
|
230
|
+
(= (or (alist-get 'version result) -1) eliscript-repl--result-version)
|
|
231
|
+
(integerp (alist-get 'id result))))
|
|
232
|
+
|
|
233
|
+
(defun eliscript-repl--handle-result (session result)
|
|
234
|
+
"Deliver one parsed protocol RESULT for SESSION."
|
|
235
|
+
(if (not (eliscript-repl--valid-result-p result))
|
|
236
|
+
(eliscript-repl--insert-result
|
|
237
|
+
session
|
|
238
|
+
`((format . ,eliscript-repl--result-format)
|
|
239
|
+
(version . ,eliscript-repl--result-version)
|
|
240
|
+
(id . 0) (operation . "unknown") (revision . 0)
|
|
241
|
+
(status . "error")
|
|
242
|
+
(diagnostic
|
|
243
|
+
(message . "invalid evaluation protocol result"))))
|
|
244
|
+
(setf (eliscript-repl--session-restart-failures session) 0)
|
|
245
|
+
(let* ((id (alist-get 'id result))
|
|
246
|
+
(pending (gethash id (eliscript-repl--session-pending session))))
|
|
247
|
+
(when pending
|
|
248
|
+
(remhash id (eliscript-repl--session-pending session))
|
|
249
|
+
(eliscript-repl--remember-result session pending result)
|
|
250
|
+
(unless (and (eliscript-repl--pending-internal pending)
|
|
251
|
+
(string-equal (alist-get 'status result) "ok"))
|
|
252
|
+
(eliscript-repl--insert-result session result))
|
|
253
|
+
(when-let* ((callback (eliscript-repl--pending-callback pending)))
|
|
254
|
+
(if-let* ((buffer (eliscript-repl--pending-source-buffer pending)))
|
|
255
|
+
(when (buffer-live-p buffer)
|
|
256
|
+
(with-current-buffer buffer (funcall callback result)))
|
|
257
|
+
(funcall callback result)))))))
|
|
258
|
+
|
|
259
|
+
(defun eliscript-repl--process-filter (process output)
|
|
260
|
+
"Consume NDJSON OUTPUT from evaluation PROCESS."
|
|
261
|
+
(when-let* ((session (process-get process 'eliscript-repl-session)))
|
|
262
|
+
(when (eq process (eliscript-repl--session-process session))
|
|
263
|
+
(let* ((text (concat (eliscript-repl--session-fragment session) output))
|
|
264
|
+
(lines (split-string text "\n"))
|
|
265
|
+
(complete (butlast lines))
|
|
266
|
+
(fragment (car (last lines))))
|
|
267
|
+
(setf (eliscript-repl--session-fragment session) fragment)
|
|
268
|
+
(dolist (line complete)
|
|
269
|
+
(unless (string-empty-p line)
|
|
270
|
+
(condition-case error-data
|
|
271
|
+
(eliscript-repl--handle-result
|
|
272
|
+
session
|
|
273
|
+
(json-parse-string
|
|
274
|
+
line :object-type 'alist :array-type 'list
|
|
275
|
+
:null-object nil :false-object :false))
|
|
276
|
+
(error
|
|
277
|
+
(eliscript-repl--insert-result
|
|
278
|
+
session
|
|
279
|
+
`((format . ,eliscript-repl--result-format)
|
|
280
|
+
(version . ,eliscript-repl--result-version)
|
|
281
|
+
(id . 0) (operation . "unknown") (revision . 0)
|
|
282
|
+
(status . "error")
|
|
283
|
+
(diagnostic
|
|
284
|
+
(message . ,(format "invalid evaluation protocol JSON: %s"
|
|
285
|
+
(error-message-string error-data))))))))))))))
|
|
286
|
+
|
|
287
|
+
(defun eliscript-repl--cleanup-process-buffers (session)
|
|
288
|
+
"Kill transient process buffers owned by SESSION."
|
|
289
|
+
(dolist (buffer (list (eliscript-repl--session-process-buffer session)
|
|
290
|
+
(eliscript-repl--session-error-buffer session)))
|
|
291
|
+
(when (buffer-live-p buffer) (kill-buffer buffer)))
|
|
292
|
+
(setf (eliscript-repl--session-process-buffer session) nil
|
|
293
|
+
(eliscript-repl--session-error-buffer session) nil))
|
|
294
|
+
|
|
295
|
+
(defun eliscript-repl--process-sentinel (process _event)
|
|
296
|
+
"Recover SESSION when evaluation PROCESS exits unexpectedly."
|
|
297
|
+
(when-let* ((session (process-get process 'eliscript-repl-session)))
|
|
298
|
+
(when (and (eq process (eliscript-repl--session-process session))
|
|
299
|
+
(memq (process-status process) '(exit signal)))
|
|
300
|
+
(setf (eliscript-repl--session-process session) nil
|
|
301
|
+
(eliscript-repl--session-state session) 'inactive)
|
|
302
|
+
(maphash
|
|
303
|
+
(lambda (_id pending)
|
|
304
|
+
(let ((result
|
|
305
|
+
(eliscript-repl--synthetic-restart-result pending 0)))
|
|
306
|
+
(unless (eliscript-repl--pending-internal pending)
|
|
307
|
+
(eliscript-repl--insert-result session result)
|
|
308
|
+
(when-let* ((callback
|
|
309
|
+
(eliscript-repl--pending-callback pending)))
|
|
310
|
+
(funcall callback result)))))
|
|
311
|
+
(eliscript-repl--session-pending session))
|
|
312
|
+
(clrhash (eliscript-repl--session-pending session))
|
|
313
|
+
(eliscript-repl--cleanup-process-buffers session)
|
|
314
|
+
(unless (eliscript-repl--session-stopped session)
|
|
315
|
+
(cl-incf (eliscript-repl--session-restart-failures session))
|
|
316
|
+
(if (<= (eliscript-repl--session-restart-failures session) 1)
|
|
317
|
+
(run-at-time 0.05 nil #'eliscript-repl--start session)
|
|
318
|
+
(eliscript-repl--insert-result
|
|
319
|
+
session
|
|
320
|
+
`((format . ,eliscript-repl--result-format)
|
|
321
|
+
(version . ,eliscript-repl--result-version)
|
|
322
|
+
(id . 0) (operation . "restart") (revision . 0)
|
|
323
|
+
(status . "error")
|
|
324
|
+
(diagnostic
|
|
325
|
+
(message . "evaluation process failed to restart")))))))))
|
|
326
|
+
|
|
327
|
+
(defun eliscript-repl--write (session pending)
|
|
328
|
+
"Write PENDING request to ready SESSION."
|
|
329
|
+
(let* ((process (eliscript-repl--session-process session))
|
|
330
|
+
(id (cl-incf (eliscript-repl--session-next-id session)))
|
|
331
|
+
(payload (copy-tree (eliscript-repl--pending-payload pending))))
|
|
332
|
+
(setf (eliscript-repl--pending-id pending) id
|
|
333
|
+
(alist-get 'id payload) id)
|
|
334
|
+
(puthash id pending (eliscript-repl--session-pending session))
|
|
335
|
+
(process-send-string
|
|
336
|
+
process
|
|
337
|
+
(concat (json-serialize payload :null-object nil :false-object :false)
|
|
338
|
+
"\n"))))
|
|
339
|
+
|
|
340
|
+
(defun eliscript-repl--drain (session)
|
|
341
|
+
"Send queued user requests after SESSION becomes ready."
|
|
342
|
+
(let ((queued (nreverse (eliscript-repl--session-queue session))))
|
|
343
|
+
(setf (eliscript-repl--session-queue session) nil)
|
|
344
|
+
(dolist (pending queued) (eliscript-repl--write session pending))))
|
|
345
|
+
|
|
346
|
+
(defun eliscript-repl--restore (session requests)
|
|
347
|
+
"Replay acknowledged REQUESTS before making SESSION ready."
|
|
348
|
+
(if (null requests)
|
|
349
|
+
(progn
|
|
350
|
+
(setf (eliscript-repl--session-state session) 'ready)
|
|
351
|
+
(eliscript-repl--drain session))
|
|
352
|
+
(let ((pending
|
|
353
|
+
(eliscript-repl--pending-create
|
|
354
|
+
:payload (copy-tree (cdar requests))
|
|
355
|
+
:internal t
|
|
356
|
+
:callback
|
|
357
|
+
(lambda (result)
|
|
358
|
+
(if (string-equal (alist-get 'status result) "ok")
|
|
359
|
+
(eliscript-repl--restore session (cdr requests))
|
|
360
|
+
(setf (eliscript-repl--session-state session) 'ready)
|
|
361
|
+
(eliscript-repl--drain session))))))
|
|
362
|
+
(eliscript-repl--write session pending))))
|
|
363
|
+
|
|
364
|
+
(defun eliscript-repl--start (session)
|
|
365
|
+
"Start SESSION and restore its last acknowledged namespace."
|
|
366
|
+
(unless (process-live-p (eliscript-repl--session-process session))
|
|
367
|
+
(let* ((default-directory (eliscript-repl--session-root session))
|
|
368
|
+
(program (eliscript-repl--program))
|
|
369
|
+
(command (cons program (cdr eliscript-mode-eval-command)))
|
|
370
|
+
(process-buffer (generate-new-buffer " *eliscript-eval-output*"))
|
|
371
|
+
(error-buffer (generate-new-buffer " *eliscript-eval-error*")))
|
|
372
|
+
(condition-case error-data
|
|
373
|
+
(let ((process
|
|
374
|
+
(make-process
|
|
375
|
+
:name "eliscript-eval"
|
|
376
|
+
:buffer process-buffer
|
|
377
|
+
:stderr error-buffer
|
|
378
|
+
:command command
|
|
379
|
+
:connection-type 'pipe
|
|
380
|
+
:coding 'utf-8-unix
|
|
381
|
+
:noquery t
|
|
382
|
+
:filter #'eliscript-repl--process-filter
|
|
383
|
+
:sentinel #'eliscript-repl--process-sentinel)))
|
|
384
|
+
(process-put process 'eliscript-repl-session session)
|
|
385
|
+
(setf (eliscript-repl--session-process session) process
|
|
386
|
+
(eliscript-repl--session-process-buffer session) process-buffer
|
|
387
|
+
(eliscript-repl--session-error-buffer session) error-buffer
|
|
388
|
+
(eliscript-repl--session-fragment session) ""
|
|
389
|
+
(eliscript-repl--session-stopped session) nil
|
|
390
|
+
(eliscript-repl--session-state session) 'restoring)
|
|
391
|
+
(cl-incf (eliscript-repl--session-generation session))
|
|
392
|
+
(eliscript-repl--restore
|
|
393
|
+
session (copy-tree (eliscript-repl--session-recovery session))))
|
|
394
|
+
(error
|
|
395
|
+
(when (buffer-live-p process-buffer) (kill-buffer process-buffer))
|
|
396
|
+
(when (buffer-live-p error-buffer) (kill-buffer error-buffer))
|
|
397
|
+
(signal (car error-data) (cdr error-data))))))
|
|
398
|
+
session)
|
|
399
|
+
|
|
400
|
+
(defun eliscript-repl--submit (payload &optional callback)
|
|
401
|
+
"Submit evaluation PAYLOAD and invoke CALLBACK with its result."
|
|
402
|
+
(let* ((session (eliscript-repl--session))
|
|
403
|
+
(pending
|
|
404
|
+
(eliscript-repl--pending-create
|
|
405
|
+
:payload payload
|
|
406
|
+
:callback callback
|
|
407
|
+
:source-buffer (current-buffer))))
|
|
408
|
+
(unless (process-live-p (eliscript-repl--session-process session))
|
|
409
|
+
(eliscript-repl--start session))
|
|
410
|
+
(if (eq (eliscript-repl--session-state session) 'ready)
|
|
411
|
+
(eliscript-repl--write session pending)
|
|
412
|
+
(push pending (eliscript-repl--session-queue session)))
|
|
413
|
+
session))
|
|
414
|
+
|
|
415
|
+
(defun eliscript-repl--source-request (operation source filename line column)
|
|
416
|
+
"Build an OPERATION request for SOURCE at FILENAME, LINE, and COLUMN."
|
|
417
|
+
`((operation . ,operation)
|
|
418
|
+
(source . ,source)
|
|
419
|
+
(filename . ,filename)
|
|
420
|
+
(root . ,(eliscript-repl--canonical-root))
|
|
421
|
+
(line . ,line)
|
|
422
|
+
(column . ,column)))
|
|
423
|
+
|
|
424
|
+
(defun eliscript-mode-eval-region (start end)
|
|
425
|
+
"Evaluate the Eliscript form in region START through END."
|
|
426
|
+
(interactive "r")
|
|
427
|
+
(let ((filename (or buffer-file-name
|
|
428
|
+
(expand-file-name
|
|
429
|
+
(concat (buffer-name) ".eli") default-directory)))
|
|
430
|
+
line column source)
|
|
431
|
+
(save-restriction
|
|
432
|
+
(widen)
|
|
433
|
+
(setq source (buffer-substring-no-properties start end))
|
|
434
|
+
(save-excursion
|
|
435
|
+
(goto-char start)
|
|
436
|
+
(setq line (line-number-at-pos)
|
|
437
|
+
column (1+ (current-column)))))
|
|
438
|
+
(eliscript-repl--submit
|
|
439
|
+
(eliscript-repl--source-request
|
|
440
|
+
"evaluate" source filename line column))))
|
|
441
|
+
|
|
442
|
+
(defun eliscript-mode-eval-last-form ()
|
|
443
|
+
"Evaluate the complete Eliscript form preceding point."
|
|
444
|
+
(interactive)
|
|
445
|
+
(let (start end)
|
|
446
|
+
(save-excursion
|
|
447
|
+
(skip-chars-backward " \t\r\n")
|
|
448
|
+
(setq end (point)
|
|
449
|
+
start (condition-case nil (scan-sexps end -1)
|
|
450
|
+
(scan-error nil))))
|
|
451
|
+
(unless start
|
|
452
|
+
(signal 'eliscript-mode-error
|
|
453
|
+
'("no complete Eliscript form precedes point")))
|
|
454
|
+
(eliscript-mode-eval-region start end)))
|
|
455
|
+
|
|
456
|
+
(defun eliscript-mode-eval-buffer ()
|
|
457
|
+
"Load the current unsaved buffer into its project evaluation session."
|
|
458
|
+
(interactive)
|
|
459
|
+
(unless buffer-file-name
|
|
460
|
+
(signal 'eliscript-mode-error
|
|
461
|
+
'("buffer evaluation requires a file-backed buffer")))
|
|
462
|
+
(let (source)
|
|
463
|
+
(save-restriction
|
|
464
|
+
(widen)
|
|
465
|
+
(setq source (buffer-substring-no-properties (point-min) (point-max))))
|
|
466
|
+
(eliscript-repl--submit
|
|
467
|
+
(eliscript-repl--source-request
|
|
468
|
+
"load" source (expand-file-name buffer-file-name) 1 1))))
|
|
469
|
+
|
|
470
|
+
(defun eliscript-mode-eval-defun ()
|
|
471
|
+
"Reload the current unsaved buffer as the definition namespace."
|
|
472
|
+
(interactive)
|
|
473
|
+
(unless (eliscript-mode--current-definition-start)
|
|
474
|
+
(signal 'eliscript-mode-error
|
|
475
|
+
'("point is not inside an Eliscript definition")))
|
|
476
|
+
(eliscript-mode-eval-buffer))
|
|
477
|
+
|
|
478
|
+
(defun eliscript-mode-show-repl ()
|
|
479
|
+
"Display the current project's evaluation result buffer."
|
|
480
|
+
(interactive)
|
|
481
|
+
(display-buffer
|
|
482
|
+
(eliscript-repl--result-buffer (eliscript-repl--session))))
|
|
483
|
+
|
|
484
|
+
(defun eliscript-mode-stop-repl ()
|
|
485
|
+
"Stop and forget the current project's evaluation session."
|
|
486
|
+
(interactive)
|
|
487
|
+
(let* ((root (eliscript-repl--canonical-root))
|
|
488
|
+
(session (gethash root eliscript-repl--sessions)))
|
|
489
|
+
(when session
|
|
490
|
+
(setf (eliscript-repl--session-stopped session) t
|
|
491
|
+
(eliscript-repl--session-recovery session) nil
|
|
492
|
+
(eliscript-repl--session-queue session) nil)
|
|
493
|
+
(when (process-live-p (eliscript-repl--session-process session))
|
|
494
|
+
(delete-process (eliscript-repl--session-process session)))
|
|
495
|
+
(eliscript-repl--cleanup-process-buffers session)
|
|
496
|
+
(remhash root eliscript-repl--sessions)
|
|
497
|
+
(message "Eliscript evaluation session stopped"))))
|
|
498
|
+
|
|
499
|
+
(provide 'eliscript-repl)
|
|
500
|
+
|
|
501
|
+
;;; eliscript-repl.el ends here
|
package/package.json
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eliscript",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "An Emacs Lisp-flavored language that compiles to modern JavaScript.",
|
|
5
|
+
"license": "GPL-3.0-or-later",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/liuchong/eliscript.git"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"lisp",
|
|
12
|
+
"emacs-lisp",
|
|
13
|
+
"compiler",
|
|
14
|
+
"esm",
|
|
15
|
+
"persistent-data"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public",
|
|
19
|
+
"registry": "https://registry.npmjs.org/"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
"./compiler": "./dist/bootstrap/compiler.mjs",
|
|
23
|
+
"./compiler.mjs": "./dist/bootstrap/compiler.mjs",
|
|
24
|
+
"./browser": "./browser/host.mjs",
|
|
25
|
+
"./browser/host.mjs": "./browser/host.mjs",
|
|
26
|
+
"./browser/worker.mjs": "./browser/worker.mjs",
|
|
27
|
+
"./browser/compiler": "./dist/browser/compiler.js",
|
|
28
|
+
"./runtime/literals": "./runtime/literals.mjs",
|
|
29
|
+
"./runtime/literals.mjs": "./runtime/literals.mjs",
|
|
30
|
+
"./runtime/source-mapping": "./runtime/source-mapping.mjs",
|
|
31
|
+
"./runtime/source-mapping.mjs": "./runtime/source-mapping.mjs",
|
|
32
|
+
"./runtime/worker-value-stream": "./runtime/worker-value-stream.mjs",
|
|
33
|
+
"./runtime/worker-value-stream.mjs": "./runtime/worker-value-stream.mjs",
|
|
34
|
+
"./platform/browser": "./platform/browser.mjs",
|
|
35
|
+
"./platform/browser.mjs": "./platform/browser.mjs",
|
|
36
|
+
"./platform/worker": "./platform/worker.mjs",
|
|
37
|
+
"./platform/worker.mjs": "./platform/worker.mjs",
|
|
38
|
+
"./*": "./*"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"prepack": "./bin/eliscript-bootstrap && bun run build:browser",
|
|
42
|
+
"build:browser": "bun build dist/bootstrap/compiler.mjs --target=browser --format=esm --outfile dist/browser/compiler.js",
|
|
43
|
+
"test": "make test",
|
|
44
|
+
"test:core": "make test-core",
|
|
45
|
+
"test:applications": "make test-applications",
|
|
46
|
+
"check:contracts": "make check-contracts",
|
|
47
|
+
"check:diagnostics": "bun tools/diagnostics/check.mjs",
|
|
48
|
+
"check:compiler-parity": "bun tools/parity/check.mjs",
|
|
49
|
+
"check:compatibility-corpus": "bun tools/compatibility/corpus.mjs",
|
|
50
|
+
"check:compatibility-matrix": "bun tools/compatibility/matrix.mjs --verify-all",
|
|
51
|
+
"check:source-debugging": "bun tools/debugging/check.mjs",
|
|
52
|
+
"check:dogfood:browsers": "bun tools/browser/matrix.mjs --site examples/dogfood/_site --out examples/dogfood/evidence/browser-matrix.json",
|
|
53
|
+
"check:dogfood": "./bin/eliscript --output dist/dogfood-spec-check.mjs examples/dogfood/tools/spec-check.eli && bun dist/dogfood-spec-check.mjs --root examples/dogfood",
|
|
54
|
+
"build:docs-site": "./bin/eliscript --output dist/docs-site/loader.mjs docs/pages/loader.eli && bun build dist/docs-site/loader.mjs --target=browser --format=iife --outfile dist/docs-site/site.js",
|
|
55
|
+
"build:dogfood-browser": "./bin/eliscript-build --root examples/dogfood --out-dir examples/dogfood/dist/dogfood-browser examples/dogfood/src/renderer/browser.eli && bun build examples/dogfood/dist/dogfood-browser/src/renderer/browser.mjs --target=browser --format=iife --outfile examples/dogfood/dist/site/browser.js",
|
|
56
|
+
"build:browser-playground": "./bin/eliscript-build --root examples/browser-playground/src --out-dir dist/browser-playground examples/browser-playground/src/playground.eli && cp examples/browser-playground/index.html examples/browser-playground/site.css dist/browser-playground/",
|
|
57
|
+
"preview": "python3 -m http.server 8787 --bind 127.0.0.1",
|
|
58
|
+
"build:dogfood": "./bin/eliscript-build --config examples/dogfood/eliscript.json",
|
|
59
|
+
"dogfood": "bun run build:dogfood-browser && ./bin/eliscript-build --config examples/dogfood/eliscript.json && bun examples/dogfood/dist/src/builder/main.mjs --root examples/dogfood",
|
|
60
|
+
"package:dogfood": "./bin/eliscript --output dist/dogfood-package.mjs examples/dogfood/tools/package.eli && node dist/dogfood-package.mjs --root .",
|
|
61
|
+
"dogfood:action": "node examples/dogfood/dist/action/index.js --root examples/dogfood",
|
|
62
|
+
"check:docs": "bun tools/documentation/check.mjs",
|
|
63
|
+
"check:onboarding": "bun tools/onboarding/check.mjs --verify-run acceptance/runs/m13-02.json --verify-markdown acceptance/runs/m13-02.md",
|
|
64
|
+
"check:compatibility-rehearsal": "bun tools/compatibility/rehearse.mjs --verify-run acceptance/runs/m13-03.json --verify-markdown acceptance/runs/m13-03.md",
|
|
65
|
+
"check:integrity": "bun tools/integrity/check.mjs",
|
|
66
|
+
"audit:dependencies": "bun tools/integrity/check.mjs --dependencies",
|
|
67
|
+
"audit:artifacts": "bun tools/integrity/check.mjs --artifacts",
|
|
68
|
+
"check:acceptance": "bun tools/acceptance/check.mjs --verify-run acceptance/runs/m13-01.json --verify-markdown acceptance/runs/m13-01.md",
|
|
69
|
+
"check:repeated-determinism": "bun tools/acceptance/repeat.mjs --verify --json-report acceptance/runs/m13-04.json --markdown-report acceptance/runs/m13-04.md",
|
|
70
|
+
"check:final-acceptance": "bun tools/acceptance/finalize.mjs --verify",
|
|
71
|
+
"progress": "bun tools/progress/check.mjs",
|
|
72
|
+
"generate:api": "bun tools/surface/generate-api.mjs",
|
|
73
|
+
"format": "./bin/eliscript-format --write",
|
|
74
|
+
"format:check": "./bin/eliscript-format --check",
|
|
75
|
+
"compile:example": "./bin/eliscript --output dist/basic.mjs examples/basic/main.eli",
|
|
76
|
+
"compile:sequence": "./bin/eliscript --source-map --output dist/stdlib/sequence.mjs stdlib/sequence.eli",
|
|
77
|
+
"compile:text": "./bin/eliscript --source-map --output dist/stdlib/text.mjs stdlib/text.eli",
|
|
78
|
+
"compile:object": "./bin/eliscript --source-map --output dist/stdlib/object.mjs stdlib/object.eli",
|
|
79
|
+
"compile:bit": "./bin/eliscript --source-map --output dist/stdlib/bit.mjs stdlib/bit.eli",
|
|
80
|
+
"compile:identifier": "./bin/eliscript --source-map --output dist/stdlib/identifier.mjs stdlib/identifier.eli",
|
|
81
|
+
"compile:persistent-list": "./bin/eliscript --source-map --output dist/stdlib/persistent-list.mjs stdlib/persistent-list.eli",
|
|
82
|
+
"compile:persistent-map": "./bin/eliscript --source-map --output dist/stdlib/persistent-map.mjs stdlib/persistent-map.eli",
|
|
83
|
+
"compile:persistent-set": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/persistent-set.eli",
|
|
84
|
+
"compile:persistent-vector": "./bin/eliscript --source-map --output dist/stdlib/persistent-vector.mjs stdlib/persistent-vector.eli",
|
|
85
|
+
"compile:value": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/value.eli",
|
|
86
|
+
"compile:metadata": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/metadata.eli",
|
|
87
|
+
"compile:numeric": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/numeric.eli",
|
|
88
|
+
"compile:result": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/result.eli",
|
|
89
|
+
"compile:json": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/json.eli",
|
|
90
|
+
"compile:data-text": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/data-text.eli",
|
|
91
|
+
"compile:function": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/function.eli",
|
|
92
|
+
"compile:deferred": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/deferred.eli",
|
|
93
|
+
"compile:atom": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/state/atom.eli",
|
|
94
|
+
"compile:interop": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/interop/js.eli",
|
|
95
|
+
"compile:data": "./bin/eliscript-build --root stdlib --out-dir dist/stdlib stdlib/data.eli",
|
|
96
|
+
"compile:stdlib": "bun run compile:bit && bun run compile:identifier && bun run compile:sequence && bun run compile:text && bun run compile:persistent-list && bun run compile:persistent-map && bun run compile:persistent-set && bun run compile:persistent-vector && bun run compile:value && bun run compile:metadata && bun run compile:numeric && bun run compile:result && bun run compile:json && bun run compile:data-text && bun run compile:function && bun run compile:deferred && bun run compile:atom && bun run compile:interop && bun run compile:data",
|
|
97
|
+
"generate:runtime-protocol": "./bin/eliscript --source-map --output runtime/core/protocol-impl.mjs stdlib/core/protocol.eli",
|
|
98
|
+
"generate:runtime-text": "./bin/eliscript --source-map --output runtime/core/text-impl.mjs stdlib/core/text.eli",
|
|
99
|
+
"generate:runtime-object": "./bin/eliscript --source-map --output runtime/core/object-impl.mjs stdlib/core/object.eli",
|
|
100
|
+
"generate:runtime-core": "bun run generate:runtime-protocol && bun run generate:runtime-text && bun run generate:runtime-object",
|
|
101
|
+
"build:stdlib-cli": "./bin/eliscript-build --root . --out-dir dist/project examples/stdlib-cli/main.eli",
|
|
102
|
+
"example": "bun run dist/basic.mjs",
|
|
103
|
+
"compile:react-counter": "./bin/eliscript --source-map --output dist/react-counter.mjs examples/react-counter/main.eli",
|
|
104
|
+
"react-counter": "bun run examples/react-counter/render.mjs",
|
|
105
|
+
"dev:react-counter": "vite --config examples/react-counter/vite.config.mjs",
|
|
106
|
+
"build:react-counter": "vite build --config examples/react-counter/vite.config.mjs",
|
|
107
|
+
"preview:react-counter": "vite preview --config examples/react-counter/vite.config.mjs",
|
|
108
|
+
"org:export": "./bin/eliscript-org --output dist/org-articles.mjs examples/org-site/content",
|
|
109
|
+
"dev:org-site": "vite --config examples/org-site/vite.config.mjs",
|
|
110
|
+
"build:org-site": "vite build --config examples/org-site/vite.config.mjs",
|
|
111
|
+
"preview:org-site": "vite preview --config examples/org-site/vite.config.mjs",
|
|
112
|
+
"build:bootstrap": "./bin/eliscript-bootstrap",
|
|
113
|
+
"benchmark:worker": "${EMACS:-emacs} --batch -Q --script tools/worker/benchmark.el",
|
|
114
|
+
"benchmark:core": "bun tools/performance/core-benchmark.mjs",
|
|
115
|
+
"benchmark:emacs-analysis": "${EMACS:-emacs} --batch -Q --script tools/worker/analysis-benchmark.el",
|
|
116
|
+
"soak:emacs-analysis": "${EMACS:-emacs} --batch -Q --script tools/worker/analysis-soak.el",
|
|
117
|
+
"soak:worker-lifecycle": "${EMACS:-emacs} --batch -Q --script tools/worker/lifecycle-soak.el",
|
|
118
|
+
"probe:worker-values": "${EMACS:-emacs} --batch -Q --script tools/worker/value-stream-probe.el",
|
|
119
|
+
"benchmark:hamt-layout": "bun tools/collections/benchmark.mjs",
|
|
120
|
+
"benchmark:transient-builders": "bun tools/collections/transient-builder-benchmark.mjs",
|
|
121
|
+
"benchmark:compiler-runtime-scan": "bun tools/compiler/runtime-scan-benchmark.mjs",
|
|
122
|
+
"benchmark:compiler-ir-kind": "bun tools/compiler/ir-kind-benchmark.mjs",
|
|
123
|
+
"benchmark:compiler-indent": "bun tools/compiler/indent-benchmark.mjs",
|
|
124
|
+
"benchmark:compiler-locate": "bun tools/compiler/locate-benchmark.mjs",
|
|
125
|
+
"benchmark:compiler-binary-comparison": "bun tools/compiler/binary-comparison-benchmark.mjs",
|
|
126
|
+
"benchmark:compiler-reader-character": "bun tools/compiler/reader-character-benchmark.mjs",
|
|
127
|
+
"benchmark:compiler-source-map-cursor": "bun tools/compiler/source-map-cursor-benchmark.mjs",
|
|
128
|
+
"fuzz:reader-program": "bun tools/fuzz/reader-program-fuzz.mjs",
|
|
129
|
+
"fuzz:persistent-semantics": "bun tools/collections/persistent-semantics.mjs",
|
|
130
|
+
"scale:project": "bun tools/project/scale-invalidation.mjs"
|
|
131
|
+
},
|
|
132
|
+
"engines": {
|
|
133
|
+
"node": ">=24.0.0",
|
|
134
|
+
"bun": ">=1.4.0"
|
|
135
|
+
},
|
|
136
|
+
"bin": {
|
|
137
|
+
"eliscript": "bootstrap/host/eliscript-cli.mjs",
|
|
138
|
+
"eliscript-build": "bootstrap/host/eliscript-cli.mjs",
|
|
139
|
+
"eliscript-check": "bootstrap/host/eliscript-cli.mjs",
|
|
140
|
+
"eliscript-format": "bootstrap/host/eliscript-cli.mjs",
|
|
141
|
+
"eliscript-eval": "bootstrap/host/eliscript-cli.mjs",
|
|
142
|
+
"eliscript-watch": "bootstrap/host/eliscript-cli.mjs"
|
|
143
|
+
},
|
|
144
|
+
"files": [
|
|
145
|
+
"bin/",
|
|
146
|
+
"bootstrap/",
|
|
147
|
+
"browser/",
|
|
148
|
+
"compiler/",
|
|
149
|
+
"dist/bootstrap/",
|
|
150
|
+
"dist/browser/",
|
|
151
|
+
"editor/",
|
|
152
|
+
"platform/",
|
|
153
|
+
"runtime/",
|
|
154
|
+
"stdlib/"
|
|
155
|
+
],
|
|
156
|
+
"devDependencies": {
|
|
157
|
+
"@vitejs/plugin-react": "6.1.0",
|
|
158
|
+
"playwright-core": "1.63.0",
|
|
159
|
+
"react": "19.2.8",
|
|
160
|
+
"react-dom": "19.2.8",
|
|
161
|
+
"vite": "8.2.2"
|
|
162
|
+
}
|
|
163
|
+
}
|