basedpl 0.1.28 → 0.1.32
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 +47 -217
- package/basedpl_wasm.js +506 -20
- package/basedpl_wasm_bg.wasm +0 -0
- package/bpl.tmLanguage.json +108 -0
- package/canvas.js +8 -0
- package/input.js +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,242 +1,72 @@
|
|
|
1
|
-
#
|
|
1
|
+
# basedpl
|
|
2
2
|
|
|
3
|
+
This package runs BasedPL (BPL) in a web page. BPL is an array language derived from APL, with ideas from J and BQN. The package holds the BPL interpreter compiled to WebAssembly, a language bar for typing BPL's glyphs, and a TextMate grammar for highlighting BPL code. The [BPL documentation](https://answerdotai.github.io/basedpl/) covers the language. The [playground](https://answerdotai.github.io/basedpl/playground.html) runs BPL in the browser with this package.
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
## Load the package
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
jsDelivr serves every file in the package. An unversioned URL, such as `https://cdn.jsdelivr.net/npm/basedpl/basedpl_wasm.js`, gives the latest release. To keep one release, put its version in the URL: `https://cdn.jsdelivr.net/npm/basedpl@<version>/basedpl_wasm.js`. To install the package instead, run `npm install basedpl`.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
## Run BPL
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
```js
|
|
12
|
+
import init, { Session, configure } from 'https://cdn.jsdelivr.net/npm/basedpl/basedpl_wasm.js';
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
await init();
|
|
15
|
+
configure(location.href, message => console.error(message));
|
|
16
|
+
const session = new Session();
|
|
17
|
+
const error = session.run('avg←+/÷≢ ⋄ avg 2 4 9', output => console.log(output.data['text/plain']));
|
|
15
18
|
```
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
This logs `5`, and `error` is `null`.
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
On Linux, download `bpl-linux-x86_64` or `bpl-linux-arm64` instead.
|
|
25
|
-
|
|
26
|
-
At the prompt, define a mean and apply it:
|
|
27
|
-
|
|
28
|
-
``` bpl
|
|
29
|
-
avg←+/÷≢
|
|
30
|
-
avg 2 4 9
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
5
|
|
34
|
-
|
|
35
|
-
Use `bpl -e 'avg←+/÷≢ ⋄ avg 2 4 9'` for a shell command. The [command-line guide](https://answerdotai.github.io/basedpl/cli.html) covers source files and pipes.
|
|
36
|
-
|
|
37
|
-
## Interactive use
|
|
38
|
-
|
|
39
|
-
In the REPL, type a backtick followed by a glyph name. For example, `` `iota `` becomes `⍳` when you press Tab or type a non-letter. Abbreviations and Alt-key shortcuts are available. `]help +` shows help for `+`. [`•prefs`](https://answerdotai.github.io/basedpl/system-functions.html#prefs) changes display settings, such as boxes and how much of a large array shows. See [REPL](https://answerdotai.github.io/basedpl/repl.html) and the [glyph reference](https://answerdotai.github.io/basedpl/glyphs.html), which lists each glyph’s key.
|
|
40
|
-
|
|
41
|
-
In Jupyter, select the installed **BasedPL** kernel. Cells share definitions and support completion, Shift-Tab help and interruption. You can also use `%%bpl` cells in a Python notebook. See [Using BPL notebooks](https://answerdotai.github.io/basedpl/notebooks.html).
|
|
42
|
-
|
|
43
|
-
## New to APL?
|
|
44
|
-
|
|
45
|
-
APL is a language built around operations on whole arrays and notation for combining functions. Here is a taste of that style in BPL.
|
|
46
|
-
|
|
47
|
-
Numbers separated by spaces form a vector. Arithmetic applies to every element:
|
|
48
|
-
|
|
49
|
-
``` bpl
|
|
50
|
-
10+1 2 3
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
11 12 13
|
|
54
|
-
|
|
55
|
-
Operators modify or combine functions. Reduce (`/`) turns addition into summation. `⍳10` generates 0…9:
|
|
56
|
-
|
|
57
|
-
``` bpl
|
|
58
|
-
+/⍳10
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
45
|
|
62
|
-
|
|
63
|
-
Functions can also be combined without naming their arguments. In `avg←+/÷≢`, sum (`+/`) divided by tally (`≢`) defines the mean:
|
|
64
|
-
|
|
65
|
-
``` bpl
|
|
66
|
-
avg 1 2 3 4
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
2.5
|
|
70
|
-
|
|
71
|
-
To see how these ideas express an algorithm, start from “a prime has exactly two positive divisors”. Form all remainders of 1 to 50 (`|⊗⍨1+⍳50`), count the zeros down each column (`+⌿0=`), and find the positions (`⍸`) whose count is two. Positions count from 0. `1+` turns each position back into its number:
|
|
72
|
-
|
|
73
|
-
``` bpl
|
|
74
|
-
1+⍸2=+⌿0=|⊗⍨1+⍳50
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47
|
|
78
|
-
|
|
79
|
-
[Getting started](https://answerdotai.github.io/basedpl/getting-started.html#example-algorithms) builds a primes function from the same divisor count, step by step, and displays the divisibility matrix along the way.
|
|
80
|
-
|
|
81
|
-
## What’s distinctive?
|
|
82
|
-
|
|
83
|
-
For APL users, some key differences are:
|
|
84
|
-
|
|
85
|
-
- [Based arrays](https://answerdotai.github.io/basedpl/arrays.html), as in BQN: numbers, characters and functions are atoms; enclosure always adds a layer.
|
|
86
|
-
- **Vectors in brackets, and grouping by spaces.** `[a b c]` is a vector, and `a+b × c+d` is `(a+b)×(c+d)`. A run that ends in a function is a train. For example, `+/÷≢ x` is the mean of `x`, and `2×` doubles its argument. `0⌷v` and `v₀` both select the first item of `v`.
|
|
87
|
-
- **Leading-axis broadcasting**, including expansion of length-1 axes, plus string keys and names on axes.
|
|
88
|
-
- **Exact integers and rationals** alongside approximate real and complex numbers.
|
|
89
|
-
- Dfns, trains and operators, with additions such as Under, iteration histories, windows and function arrays.
|
|
90
|
-
|
|
91
|
-
Positions and axes count from 0, as in BQN and Python. Approximate comparisons use tolerance `1E¯14`. See the [language principles](https://answerdotai.github.io/basedpl/principles.html) for why BPL works this way, the [glyph reference](https://answerdotai.github.io/basedpl/glyphs.html) for Dyalog differences and [Arrays](https://answerdotai.github.io/basedpl/arrays.html) for the array model.
|
|
92
|
-
|
|
93
|
-
### Numbers
|
|
94
|
-
|
|
95
|
-
Bare numbers are approximate. Use `ₓ` for exact integers and `r` for exact fractions:
|
|
96
|
-
|
|
97
|
-
``` bpl
|
|
98
|
-
1r3+1r6
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
1ᵣ2
|
|
102
|
-
|
|
103
|
-
Complex numbers use `j` between real and imaginary parts. Functions such as square root extend into the complex domain:
|
|
104
|
-
|
|
105
|
-
``` bpl
|
|
106
|
-
√¯4
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
0ⱼ2
|
|
110
|
-
|
|
111
|
-
See [Numbers](https://answerdotai.github.io/basedpl/numbers.html) for conversion and mixed arithmetic.
|
|
22
|
+
- `init()` fetches the module from beside the glue.
|
|
23
|
+
- `configure(base, panic)` sets the URL that relative file reads resolve against, and the function that receives a panic's message. After a panic, the module can't run more code.
|
|
24
|
+
- `session.run(code, output)` runs `code`, then returns `null` or the error. The error is an object with `kind`, `message` and `display`. `display` holds the error as BPL shows it. A session keeps its names from one `run` to the next.
|
|
25
|
+
- `output` receives each output as the program produces it, as `{kind, data}`. `kind` is `"display"` for a displayed value, `"explicit"` for a value assigned to `⎕`, or `"text"` for text written with `"-" •nput`. Display and explicit outputs each end a line. Text output doesn't.
|
|
112
26
|
|
|
113
|
-
|
|
27
|
+
`data` maps MIME types to text, or to a `Uint8Array` for a binary type:
|
|
114
28
|
|
|
115
|
-
|
|
29
|
+
- `text/plain`: the output as text.
|
|
30
|
+
- `text/html`: markup from element functions.
|
|
31
|
+
- `image/svg+xml`: markup from `•svg` and `•plot`.
|
|
32
|
+
- `image/x-rgba;width=N`: RGBA pixels from `•image`, `N` pixels wide. `new ImageData(new Uint8ClampedArray(bytes.buffer), N)` makes a canvas image from them.
|
|
33
|
+
- `image/png` and `image/jpeg`: encoded images. An animation from `•image` is an animated PNG.
|
|
34
|
+
- `application/x-bpl-canvas+json` and `application/x-bpl-canvas-data`: a canvas from `•canvas`. `canvas.js` is a script whose value is a function that draws it: `(0, eval)(script)(canvas, data['application/x-bpl-canvas+json'], data['application/x-bpl-canvas-data'])`, where `canvas` is a `<canvas>` element.
|
|
116
35
|
|
|
117
|
-
|
|
118
|
-
m←[1 2 3
|
|
119
|
-
4 5 6]
|
|
120
|
-
m+10 20
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
11 12 13
|
|
124
|
-
24 25 26
|
|
125
|
-
|
|
126
|
-
See [array notation](https://answerdotai.github.io/basedpl/glyphs/brackets.html) and [broadcasting](https://answerdotai.github.io/basedpl/evaluation.html#agreement-and-pervasion).
|
|
127
|
-
|
|
128
|
-
### Keys and named axes
|
|
129
|
-
|
|
130
|
-
Axes can have names, and positions along them can have string keys. Describe the axes once, then select by key or reduce by axis name:
|
|
131
|
-
|
|
132
|
-
``` bpl
|
|
133
|
-
axes←["city":["NY" "LA"] "month":["Jan" "Feb" "Mar"]]
|
|
134
|
-
sales←axes:[10 20 30 ⋄ 40 50 60]
|
|
135
|
-
"LA" "Feb"⌷sales
|
|
136
|
-
+/⍠"month" sales
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
50
|
|
140
|
-
|
|
141
|
-
["city":2]⍴["NY":60 "LA":150]
|
|
142
|
-
|
|
143
|
-
Keys and names travel with axes through operations such as transpose. Arithmetic aligns matching names and keys. See [Axis keys](https://answerdotai.github.io/basedpl/keyed.html).
|
|
144
|
-
|
|
145
|
-
### Function operators
|
|
36
|
+
`run` returns only when the code finishes. To keep the page responsive, run BPL in a Web Worker. The docs' [`worker.js`](https://github.com/AnswerDotAI/basedpl/blob/main/nbs/playground/worker.js) runs BPL in a worker, and [`bpl.js`](https://github.com/AnswerDotAI/basedpl/blob/main/nbs/playground/bpl.js) starts the worker and shows each output on the page.
|
|
146
37
|
|
|
147
|
-
|
|
38
|
+
## Values and JavaScript functions
|
|
148
39
|
|
|
149
|
-
|
|
150
|
-
2×⍣(⍳5) 1
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
1 2 4 8 16
|
|
154
|
-
|
|
155
|
-
Under (`⌾`) transforms the argument, applies a function, then reverses the transformation. Scale by ten, floor, and scale back to round down to tenths:
|
|
40
|
+
`session.eval(code)` returns the value of `code` as a JavaScript value, or `undefined` when the code gives no value. A BPL error throws the error object. `session.bind(names)` binds each property of the object `names` as a BPL name. A JavaScript function becomes a BPL function that calls it, with the right argument, or the left then the right. Inside BPL, `•js source` makes such a function from JavaScript source. Values cross as the [`•js`](https://answerdotai.github.io/basedpl/system/js.html) page describes: a number is a number, a string a string and a record an object. Any other array is `{shape, data}`, with `data` a typed array when every item is a number.
|
|
156
41
|
|
|
157
|
-
```
|
|
158
|
-
|
|
42
|
+
```js
|
|
43
|
+
session.bind({ scale: 2, log: x => console.log(x) });
|
|
44
|
+
session.eval('scale×1 2 3'); // {shape: [3], data: Float64Array [2, 4, 6]}
|
|
45
|
+
session.run('log "hi"', () => {}); // logs "hi"
|
|
159
46
|
```
|
|
160
47
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
Explore [iteration and inverses](https://answerdotai.github.io/basedpl/glyphs/power.html), [Under](https://answerdotai.github.io/basedpl/glyphs/under.html), [windows](https://answerdotai.github.io/basedpl/glyphs/windows.html) and [function selection](https://answerdotai.github.io/basedpl/glyphs/agenda.html).
|
|
164
|
-
|
|
165
|
-
### Mathematical tools
|
|
166
|
-
|
|
167
|
-
[Primes](https://answerdotai.github.io/basedpl/glyphs/prime.html) and [factorisation](https://answerdotai.github.io/basedpl/glyphs/factor.html) are built in:
|
|
168
|
-
|
|
169
|
-
``` bpl
|
|
170
|
-
⨸360ₓ
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
[2 2 2 3 3 5]ₓ
|
|
174
|
-
|
|
175
|
-
[Polynomials](https://answerdotai.github.io/basedpl/glyphs/polynomial.html) support coefficients, roots and evaluation. Polynomial functions can be [differentiated](https://answerdotai.github.io/basedpl/glyphs/derivative.html): for f(x) = 1 + 2x + 3x², f′(2) = 14.
|
|
176
|
-
|
|
177
|
-
``` bpl
|
|
178
|
-
f←[1 2 3]ₓ⌻ ⋄ f∂2ₓ
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
14ₓ
|
|
182
|
-
|
|
183
|
-
[Probability distributions](https://answerdotai.github.io/basedpl/distributions.html) provide sampling, density, CDF and quantiles. Two fair coin tosses give these probabilities for 0, 1 and 2 heads:
|
|
184
|
-
|
|
185
|
-
``` bpl
|
|
186
|
-
coin←2 0.5 •distribution "binomial"
|
|
187
|
-
coin.density 0 1 2
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
0.25 0.5 0.25
|
|
191
|
-
|
|
192
|
-
[Matrix division](https://answerdotai.github.io/basedpl/glyphs/domino.html) handles linear systems and least squares.
|
|
193
|
-
|
|
194
|
-
### Data and text
|
|
195
|
-
|
|
196
|
-
JSON objects become keyed arrays, with dot access to their fields:
|
|
197
|
-
|
|
198
|
-
``` bpl
|
|
199
|
-
order←•json "{""price"":10.5,""qty"":2}"
|
|
200
|
-
order.price×order.qty
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
21
|
|
204
|
-
|
|
205
|
-
CSV headers likewise name column vectors. [Files, CSV and JSON](https://answerdotai.github.io/basedpl/data.html) covers reading, transforming and writing data. [Regex](https://answerdotai.github.io/basedpl/regex.html) supplies matching, captures and replacement through Rust’s regex engine.
|
|
206
|
-
|
|
207
|
-
### Drawing
|
|
208
|
-
|
|
209
|
-
`•plot` draws charts from arrays. Keys label the axes and name the lines. See [Plots](https://answerdotai.github.io/basedpl/plot.html).
|
|
210
|
-
|
|
211
|
-
``` bpl
|
|
212
|
-
["legend":"end"]•plot sales
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-

|
|
216
|
-
|
|
217
|
-
Build SVG from element functions and keyed attributes. Notebooks display the picture directly. The same element trees serialize to XML. See [XML and SVG](https://answerdotai.github.io/basedpl/xml.html).
|
|
218
|
-
|
|
219
|
-
``` bpl
|
|
220
|
-
circle←•element "circle"
|
|
221
|
-
text←•element "text"
|
|
222
|
-
c←["cx":50 "cy":40 "r":25 "fill":"orange"]circle ""
|
|
223
|
-
t←["x":50 "y":85 "text-anchor":"middle"]text "Hello, SVG"
|
|
224
|
-
["width":240 "height":240]•svg [c t]
|
|
225
|
-
```
|
|
48
|
+
## Differences from native BPL
|
|
226
49
|
|
|
227
|
-
|
|
50
|
+
- `•js` exists only here.
|
|
51
|
+
- `•readdir`, `•metadata`, `•copy`, `•rename`, `•remove`, `•mkdir`, `•path` and `•delay` don't exist. `•nput` writes only to `"-"`.
|
|
52
|
+
- File reads and `•fetch` are synchronous `XMLHttpRequest`s, relative to the URL given to `configure`.
|
|
53
|
+
- `•r` uses JavaScript's `RegExp`, with its syntax and replacement templates.
|
|
54
|
+
- `•date⁻¹` has no `locale` option.
|
|
55
|
+
- Function calls nest at most 380 deep. A deeper call is a `LIMIT` error.
|
|
228
56
|
|
|
229
|
-
##
|
|
57
|
+
## Language bar
|
|
230
58
|
|
|
231
|
-
BPL
|
|
59
|
+
`lb.js` adds a bar of BPL's glyphs to the page. Clicking a glyph types it into the editor used last. In a textarea marked with `data-bpl`, or a Monaco editor whose language is `bpl`, a backtick followed by a glyph's name also types the glyph, as in the BPL REPL. `lb.js` and `input.js` are scripts whose value is a function. The bar needs the glyph rows from `symbols()` and the key layout from `layout.json`:
|
|
232
60
|
|
|
233
|
-
```
|
|
234
|
-
from basedpl
|
|
61
|
+
```js
|
|
62
|
+
import init, { symbols } from 'https://cdn.jsdelivr.net/npm/basedpl/basedpl_wasm.js';
|
|
235
63
|
|
|
236
|
-
|
|
237
|
-
|
|
64
|
+
const text = name => fetch(`https://cdn.jsdelivr.net/npm/basedpl/${name}`).then(r => r.text());
|
|
65
|
+
const [lb, input, layout] = await Promise.all(['lb.js', 'input.js', 'layout.json'].map(text));
|
|
66
|
+
await init();
|
|
67
|
+
(0, eval)(lb)(JSON.parse(symbols()), (0, eval)(input), JSON.parse(layout));
|
|
238
68
|
```
|
|
239
69
|
|
|
240
|
-
|
|
70
|
+
## Highlighting
|
|
241
71
|
|
|
242
|
-
|
|
72
|
+
`bpl.tmLanguage.json` is a TextMate grammar for BPL, with the scope name `source.bpl`. Shiki and editors that read TextMate grammars use it to highlight BPL code.
|
package/basedpl_wasm.js
CHANGED
|
@@ -9,37 +9,67 @@ export class Session {
|
|
|
9
9
|
const ptr = this.__destroy_into_raw();
|
|
10
10
|
wasm.__wbg_session_free(ptr, 0);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Binds each property of `names` as a BPL name, to the BPL value that `basedpl::js` converts it to. A JavaScript function becomes a
|
|
14
|
+
* BPL function that calls it. Throws when a property's name isn't a BPL name, or its value has no BPL form.
|
|
15
|
+
* @param {any} names
|
|
16
|
+
*/
|
|
17
|
+
bind(names) {
|
|
18
|
+
try {
|
|
19
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
20
|
+
wasm.session_bind(retptr, this.__wbg_ptr, addBorrowedObject(names));
|
|
21
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
22
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
23
|
+
if (r1) {
|
|
24
|
+
throw takeObject(r0);
|
|
25
|
+
}
|
|
26
|
+
} finally {
|
|
27
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
28
|
+
heap[stack_pointer++] = undefined;
|
|
29
|
+
}
|
|
17
30
|
}
|
|
18
31
|
/**
|
|
19
|
-
* The
|
|
20
|
-
*
|
|
21
|
-
* @param {string}
|
|
22
|
-
* @
|
|
23
|
-
* @returns {string}
|
|
32
|
+
* The value of `code` as a JavaScript value, which `basedpl::js` describes, or `undefined` when the code gives no value. A BPL error
|
|
33
|
+
* throws its error object. The code's outputs are dropped, and `run` shows them.
|
|
34
|
+
* @param {string} code
|
|
35
|
+
* @returns {any}
|
|
24
36
|
*/
|
|
25
|
-
|
|
26
|
-
let deferred2_0;
|
|
27
|
-
let deferred2_1;
|
|
37
|
+
eval(code) {
|
|
28
38
|
try {
|
|
29
39
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
30
|
-
const ptr0 = passStringToWasm0(
|
|
40
|
+
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
31
41
|
const len0 = WASM_VECTOR_LEN;
|
|
32
|
-
wasm.
|
|
42
|
+
wasm.session_eval(retptr, this.__wbg_ptr, ptr0, len0);
|
|
33
43
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
34
44
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
46
|
+
if (r2) {
|
|
47
|
+
throw takeObject(r1);
|
|
48
|
+
}
|
|
49
|
+
return takeObject(r0);
|
|
38
50
|
} finally {
|
|
39
51
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
40
|
-
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
41
52
|
}
|
|
42
53
|
}
|
|
54
|
+
constructor() {
|
|
55
|
+
const ret = wasm.session_new();
|
|
56
|
+
this.__wbg_ptr = ret;
|
|
57
|
+
SessionFinalization.register(this, this.__wbg_ptr, this);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Runs `code`, passing each output to `output` as the program produces it, including any result it displays. Returns the error as
|
|
62
|
+
* an object, or `null`.
|
|
63
|
+
* @param {string} code
|
|
64
|
+
* @param {Function} output
|
|
65
|
+
* @returns {any}
|
|
66
|
+
*/
|
|
67
|
+
run(code, output) {
|
|
68
|
+
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
69
|
+
const len0 = WASM_VECTOR_LEN;
|
|
70
|
+
const ret = wasm.session_run(this.__wbg_ptr, ptr0, len0, addHeapObject(output));
|
|
71
|
+
return takeObject(ret);
|
|
72
|
+
}
|
|
43
73
|
}
|
|
44
74
|
if (Symbol.dispose) Session.prototype[Symbol.dispose] = Session.prototype.free;
|
|
45
75
|
|
|
@@ -77,14 +107,49 @@ export function symbols() {
|
|
|
77
107
|
function __wbg_get_imports() {
|
|
78
108
|
const import0 = {
|
|
79
109
|
__proto__: null,
|
|
110
|
+
__wbg___wbindgen_bigint_get_as_i64_a2383202b9353e4c: function(arg0, arg1) {
|
|
111
|
+
const v = getObject(arg1);
|
|
112
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
113
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
114
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
115
|
+
},
|
|
116
|
+
__wbg___wbindgen_boolean_get_5b446f51afd21013: function(arg0) {
|
|
117
|
+
const v = getObject(arg0);
|
|
118
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
119
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
120
|
+
},
|
|
121
|
+
__wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
|
|
122
|
+
const ret = debugString(getObject(arg1));
|
|
123
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
124
|
+
const len1 = WASM_VECTOR_LEN;
|
|
125
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
126
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
127
|
+
},
|
|
128
|
+
__wbg___wbindgen_is_bigint_b123553bed3bb382: function(arg0) {
|
|
129
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
130
|
+
return ret;
|
|
131
|
+
},
|
|
80
132
|
__wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
|
|
81
133
|
const ret = typeof(getObject(arg0)) === 'function';
|
|
82
134
|
return ret;
|
|
83
135
|
},
|
|
136
|
+
__wbg___wbindgen_is_null_e343b7d08827ba72: function(arg0) {
|
|
137
|
+
const ret = getObject(arg0) === null;
|
|
138
|
+
return ret;
|
|
139
|
+
},
|
|
140
|
+
__wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
|
|
141
|
+
const val = getObject(arg0);
|
|
142
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
143
|
+
return ret;
|
|
144
|
+
},
|
|
84
145
|
__wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
|
|
85
146
|
const ret = getObject(arg0) === undefined;
|
|
86
147
|
return ret;
|
|
87
148
|
},
|
|
149
|
+
__wbg___wbindgen_jsval_eq_02babf21faa37971: function(arg0, arg1) {
|
|
150
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
151
|
+
return ret;
|
|
152
|
+
},
|
|
88
153
|
__wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
|
|
89
154
|
const obj = getObject(arg1);
|
|
90
155
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
@@ -102,6 +167,10 @@ function __wbg_get_imports() {
|
|
|
102
167
|
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
103
168
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
104
169
|
},
|
|
170
|
+
__wbg_call_1875a20c43a36133: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
171
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
|
|
172
|
+
return addHeapObject(ret);
|
|
173
|
+
}, arguments); },
|
|
105
174
|
__wbg_call_187d372bd5fdd4aa: function() { return handleError(function (arg0, arg1, arg2) {
|
|
106
175
|
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
107
176
|
return addHeapObject(ret);
|
|
@@ -122,6 +191,14 @@ function __wbg_get_imports() {
|
|
|
122
191
|
const ret = getObject(arg0).done;
|
|
123
192
|
return ret;
|
|
124
193
|
},
|
|
194
|
+
__wbg_entries_fb6397112b1de25f: function(arg0) {
|
|
195
|
+
const ret = Object.entries(getObject(arg0));
|
|
196
|
+
return addHeapObject(ret);
|
|
197
|
+
},
|
|
198
|
+
__wbg_eval_2f4f6921d1b0da1a: function() { return handleError(function (arg0, arg1) {
|
|
199
|
+
const ret = eval(getStringFromWasm0(arg0, arg1));
|
|
200
|
+
return addHeapObject(ret);
|
|
201
|
+
}, arguments); },
|
|
125
202
|
__wbg_exec_a5f4ba02713fbebe: function(arg0, arg1, arg2) {
|
|
126
203
|
const ret = getObject(arg0).exec(getStringFromWasm0(arg1, arg2));
|
|
127
204
|
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
@@ -134,6 +211,10 @@ function __wbg_get_imports() {
|
|
|
134
211
|
const ret = getObject(arg0).fontBoundingBoxDescent;
|
|
135
212
|
return ret;
|
|
136
213
|
},
|
|
214
|
+
__wbg_from_296ca31f8d0f1c52: function(arg0) {
|
|
215
|
+
const ret = Array.from(getObject(arg0));
|
|
216
|
+
return addHeapObject(ret);
|
|
217
|
+
},
|
|
137
218
|
__wbg_getAllResponseHeaders_537d007c37d53dba: function() { return handleError(function (arg0, arg1) {
|
|
138
219
|
const ret = getObject(arg1).getAllResponseHeaders();
|
|
139
220
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -182,6 +263,16 @@ function __wbg_get_imports() {
|
|
|
182
263
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
183
264
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
184
265
|
},
|
|
266
|
+
__wbg_instanceof_BigInt64Array_1a1234d945c1625f: function(arg0) {
|
|
267
|
+
let result;
|
|
268
|
+
try {
|
|
269
|
+
result = getObject(arg0) instanceof BigInt64Array;
|
|
270
|
+
} catch (_) {
|
|
271
|
+
result = false;
|
|
272
|
+
}
|
|
273
|
+
const ret = result;
|
|
274
|
+
return ret;
|
|
275
|
+
},
|
|
185
276
|
__wbg_instanceof_CanvasRenderingContext2d_769208c72dcbf5e6: function(arg0) {
|
|
186
277
|
let result;
|
|
187
278
|
try {
|
|
@@ -202,6 +293,26 @@ function __wbg_get_imports() {
|
|
|
202
293
|
const ret = result;
|
|
203
294
|
return ret;
|
|
204
295
|
},
|
|
296
|
+
__wbg_instanceof_Float32Array_595afb0f28b828c9: function(arg0) {
|
|
297
|
+
let result;
|
|
298
|
+
try {
|
|
299
|
+
result = getObject(arg0) instanceof Float32Array;
|
|
300
|
+
} catch (_) {
|
|
301
|
+
result = false;
|
|
302
|
+
}
|
|
303
|
+
const ret = result;
|
|
304
|
+
return ret;
|
|
305
|
+
},
|
|
306
|
+
__wbg_instanceof_Float64Array_8a59377f9eec1b8b: function(arg0) {
|
|
307
|
+
let result;
|
|
308
|
+
try {
|
|
309
|
+
result = getObject(arg0) instanceof Float64Array;
|
|
310
|
+
} catch (_) {
|
|
311
|
+
result = false;
|
|
312
|
+
}
|
|
313
|
+
const ret = result;
|
|
314
|
+
return ret;
|
|
315
|
+
},
|
|
205
316
|
__wbg_instanceof_HtmlCanvasElement_0a30c11fbbf41841: function(arg0) {
|
|
206
317
|
let result;
|
|
207
318
|
try {
|
|
@@ -212,6 +323,36 @@ function __wbg_get_imports() {
|
|
|
212
323
|
const ret = result;
|
|
213
324
|
return ret;
|
|
214
325
|
},
|
|
326
|
+
__wbg_instanceof_Int16Array_dc79388a406d1748: function(arg0) {
|
|
327
|
+
let result;
|
|
328
|
+
try {
|
|
329
|
+
result = getObject(arg0) instanceof Int16Array;
|
|
330
|
+
} catch (_) {
|
|
331
|
+
result = false;
|
|
332
|
+
}
|
|
333
|
+
const ret = result;
|
|
334
|
+
return ret;
|
|
335
|
+
},
|
|
336
|
+
__wbg_instanceof_Int32Array_4b9a86620726269b: function(arg0) {
|
|
337
|
+
let result;
|
|
338
|
+
try {
|
|
339
|
+
result = getObject(arg0) instanceof Int32Array;
|
|
340
|
+
} catch (_) {
|
|
341
|
+
result = false;
|
|
342
|
+
}
|
|
343
|
+
const ret = result;
|
|
344
|
+
return ret;
|
|
345
|
+
},
|
|
346
|
+
__wbg_instanceof_Int8Array_dead59f83656e45a: function(arg0) {
|
|
347
|
+
let result;
|
|
348
|
+
try {
|
|
349
|
+
result = getObject(arg0) instanceof Int8Array;
|
|
350
|
+
} catch (_) {
|
|
351
|
+
result = false;
|
|
352
|
+
}
|
|
353
|
+
const ret = result;
|
|
354
|
+
return ret;
|
|
355
|
+
},
|
|
215
356
|
__wbg_instanceof_OffscreenCanvasRenderingContext2d_957f1a991324c9dc: function(arg0) {
|
|
216
357
|
let result;
|
|
217
358
|
try {
|
|
@@ -222,6 +363,46 @@ function __wbg_get_imports() {
|
|
|
222
363
|
const ret = result;
|
|
223
364
|
return ret;
|
|
224
365
|
},
|
|
366
|
+
__wbg_instanceof_Uint16Array_eff85aa31096af44: function(arg0) {
|
|
367
|
+
let result;
|
|
368
|
+
try {
|
|
369
|
+
result = getObject(arg0) instanceof Uint16Array;
|
|
370
|
+
} catch (_) {
|
|
371
|
+
result = false;
|
|
372
|
+
}
|
|
373
|
+
const ret = result;
|
|
374
|
+
return ret;
|
|
375
|
+
},
|
|
376
|
+
__wbg_instanceof_Uint32Array_53a4facaf04b8a8b: function(arg0) {
|
|
377
|
+
let result;
|
|
378
|
+
try {
|
|
379
|
+
result = getObject(arg0) instanceof Uint32Array;
|
|
380
|
+
} catch (_) {
|
|
381
|
+
result = false;
|
|
382
|
+
}
|
|
383
|
+
const ret = result;
|
|
384
|
+
return ret;
|
|
385
|
+
},
|
|
386
|
+
__wbg_instanceof_Uint8Array_828cef2aaacafc31: function(arg0) {
|
|
387
|
+
let result;
|
|
388
|
+
try {
|
|
389
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
390
|
+
} catch (_) {
|
|
391
|
+
result = false;
|
|
392
|
+
}
|
|
393
|
+
const ret = result;
|
|
394
|
+
return ret;
|
|
395
|
+
},
|
|
396
|
+
__wbg_instanceof_Uint8ClampedArray_ae70cf3ae1cd285f: function(arg0) {
|
|
397
|
+
let result;
|
|
398
|
+
try {
|
|
399
|
+
result = getObject(arg0) instanceof Uint8ClampedArray;
|
|
400
|
+
} catch (_) {
|
|
401
|
+
result = false;
|
|
402
|
+
}
|
|
403
|
+
const ret = result;
|
|
404
|
+
return ret;
|
|
405
|
+
},
|
|
225
406
|
__wbg_instanceof_Window_82d71df4eddf88bc: function(arg0) {
|
|
226
407
|
let result;
|
|
227
408
|
try {
|
|
@@ -232,14 +413,54 @@ function __wbg_get_imports() {
|
|
|
232
413
|
const ret = result;
|
|
233
414
|
return ret;
|
|
234
415
|
},
|
|
416
|
+
__wbg_isArray_e15a2ff68ffdbef2: function(arg0) {
|
|
417
|
+
const ret = Array.isArray(getObject(arg0));
|
|
418
|
+
return ret;
|
|
419
|
+
},
|
|
420
|
+
__wbg_length_0acba72356589f9c: function(arg0) {
|
|
421
|
+
const ret = getObject(arg0).length;
|
|
422
|
+
return ret;
|
|
423
|
+
},
|
|
424
|
+
__wbg_length_3035e53132b7a991: function(arg0) {
|
|
425
|
+
const ret = getObject(arg0).length;
|
|
426
|
+
return ret;
|
|
427
|
+
},
|
|
428
|
+
__wbg_length_511b1f84719d3462: function(arg0) {
|
|
429
|
+
const ret = getObject(arg0).length;
|
|
430
|
+
return ret;
|
|
431
|
+
},
|
|
432
|
+
__wbg_length_58572db4c38f3c3e: function(arg0) {
|
|
433
|
+
const ret = getObject(arg0).length;
|
|
434
|
+
return ret;
|
|
435
|
+
},
|
|
235
436
|
__wbg_length_7f3c00c40364105e: function(arg0) {
|
|
236
437
|
const ret = getObject(arg0).length;
|
|
237
438
|
return ret;
|
|
238
439
|
},
|
|
440
|
+
__wbg_length_961efae5d4679ef5: function(arg0) {
|
|
441
|
+
const ret = getObject(arg0).length;
|
|
442
|
+
return ret;
|
|
443
|
+
},
|
|
444
|
+
__wbg_length_b5d0ffc9b832763b: function(arg0) {
|
|
445
|
+
const ret = getObject(arg0).length;
|
|
446
|
+
return ret;
|
|
447
|
+
},
|
|
448
|
+
__wbg_length_b5f0008bbf60cf59: function(arg0) {
|
|
449
|
+
const ret = getObject(arg0).length;
|
|
450
|
+
return ret;
|
|
451
|
+
},
|
|
452
|
+
__wbg_length_beff923aab722a55: function(arg0) {
|
|
453
|
+
const ret = getObject(arg0).length;
|
|
454
|
+
return ret;
|
|
455
|
+
},
|
|
239
456
|
__wbg_length_d4bdea10311bd9cf: function(arg0) {
|
|
240
457
|
const ret = getObject(arg0).length;
|
|
241
458
|
return ret;
|
|
242
459
|
},
|
|
460
|
+
__wbg_length_e5fdd54468b9e6ed: function(arg0) {
|
|
461
|
+
const ret = getObject(arg0).length;
|
|
462
|
+
return ret;
|
|
463
|
+
},
|
|
243
464
|
__wbg_matchAll_049fec9c830bd9e3: function(arg0, arg1) {
|
|
244
465
|
const ret = getObject(arg0).matchAll(getObject(arg1));
|
|
245
466
|
return addHeapObject(ret);
|
|
@@ -264,10 +485,18 @@ function __wbg_get_imports() {
|
|
|
264
485
|
const ret = new Uint8Array(getObject(arg0));
|
|
265
486
|
return addHeapObject(ret);
|
|
266
487
|
},
|
|
488
|
+
__wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
|
|
489
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
490
|
+
return addHeapObject(ret);
|
|
491
|
+
},
|
|
267
492
|
__wbg_new_34e56228080aa9f8: function(arg0) {
|
|
268
493
|
const ret = new Date(getObject(arg0));
|
|
269
494
|
return addHeapObject(ret);
|
|
270
495
|
},
|
|
496
|
+
__wbg_new_617a8cdb8bb1130e: function() {
|
|
497
|
+
const ret = new Object();
|
|
498
|
+
return addHeapObject(ret);
|
|
499
|
+
},
|
|
271
500
|
__wbg_new_a217df4351db4b9b: function() { return handleError(function (arg0, arg1) {
|
|
272
501
|
const ret = new OffscreenCanvas(arg0 >>> 0, arg1 >>> 0);
|
|
273
502
|
return addHeapObject(ret);
|
|
@@ -276,6 +505,34 @@ function __wbg_get_imports() {
|
|
|
276
505
|
const ret = new XMLHttpRequest();
|
|
277
506
|
return addHeapObject(ret);
|
|
278
507
|
}, arguments); },
|
|
508
|
+
__wbg_new_ee2291f50781bf1d: function() {
|
|
509
|
+
const ret = new Array();
|
|
510
|
+
return addHeapObject(ret);
|
|
511
|
+
},
|
|
512
|
+
__wbg_new_from_slice_2443ca2017fac0fd: function(arg0, arg1) {
|
|
513
|
+
const ret = new Int16Array(getArrayI16FromWasm0(arg0, arg1));
|
|
514
|
+
return addHeapObject(ret);
|
|
515
|
+
},
|
|
516
|
+
__wbg_new_from_slice_911f717853b222c7: function(arg0, arg1) {
|
|
517
|
+
const ret = new Int32Array(getArrayI32FromWasm0(arg0, arg1));
|
|
518
|
+
return addHeapObject(ret);
|
|
519
|
+
},
|
|
520
|
+
__wbg_new_from_slice_9a868026ffa4208a: function(arg0, arg1) {
|
|
521
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
522
|
+
return addHeapObject(ret);
|
|
523
|
+
},
|
|
524
|
+
__wbg_new_from_slice_aa8f37bd5e72dcc7: function(arg0, arg1) {
|
|
525
|
+
const ret = new BigInt64Array(getArrayI64FromWasm0(arg0, arg1));
|
|
526
|
+
return addHeapObject(ret);
|
|
527
|
+
},
|
|
528
|
+
__wbg_new_from_slice_f545fd22ddc142b8: function(arg0, arg1) {
|
|
529
|
+
const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
|
|
530
|
+
return addHeapObject(ret);
|
|
531
|
+
},
|
|
532
|
+
__wbg_new_no_args_549db978c37d28cc: function(arg0, arg1) {
|
|
533
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
534
|
+
return addHeapObject(ret);
|
|
535
|
+
},
|
|
279
536
|
__wbg_new_with_base_29cdb449ce79d2d5: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
280
537
|
const ret = new URL(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
|
|
281
538
|
return addHeapObject(ret);
|
|
@@ -307,13 +564,48 @@ function __wbg_get_imports() {
|
|
|
307
564
|
__wbg_open_f0c8628338345808: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
|
|
308
565
|
getObject(arg0).open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), arg5 !== 0);
|
|
309
566
|
}, arguments); },
|
|
567
|
+
__wbg_parse_0fc53dead14b3b42: function() { return handleError(function (arg0, arg1) {
|
|
568
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
569
|
+
return addHeapObject(ret);
|
|
570
|
+
}, arguments); },
|
|
310
571
|
__wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
|
|
311
572
|
const ret = getObject(arg0).performance;
|
|
312
573
|
return addHeapObject(ret);
|
|
313
574
|
},
|
|
575
|
+
__wbg_prototypesetcall_06eb15da165dee8f: function(arg0, arg1, arg2) {
|
|
576
|
+
Uint32Array.prototype.set.call(getArrayU32FromWasm0(arg0, arg1), getObject(arg2));
|
|
577
|
+
},
|
|
578
|
+
__wbg_prototypesetcall_0e2bc23e51b9fbd2: function(arg0, arg1, arg2) {
|
|
579
|
+
Uint8ClampedArray.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
580
|
+
},
|
|
581
|
+
__wbg_prototypesetcall_13adbfb002dee200: function(arg0, arg1, arg2) {
|
|
582
|
+
Int32Array.prototype.set.call(getArrayI32FromWasm0(arg0, arg1), getObject(arg2));
|
|
583
|
+
},
|
|
584
|
+
__wbg_prototypesetcall_2ee09b855e324444: function(arg0, arg1, arg2) {
|
|
585
|
+
Uint16Array.prototype.set.call(getArrayU16FromWasm0(arg0, arg1), getObject(arg2));
|
|
586
|
+
},
|
|
587
|
+
__wbg_prototypesetcall_546a6fcbab18189a: function(arg0, arg1, arg2) {
|
|
588
|
+
Int8Array.prototype.set.call(getArrayI8FromWasm0(arg0, arg1), getObject(arg2));
|
|
589
|
+
},
|
|
590
|
+
__wbg_prototypesetcall_8b03c01e2c0f8066: function(arg0, arg1, arg2) {
|
|
591
|
+
Float32Array.prototype.set.call(getArrayF32FromWasm0(arg0, arg1), getObject(arg2));
|
|
592
|
+
},
|
|
593
|
+
__wbg_prototypesetcall_b275ad9519a0a737: function(arg0, arg1, arg2) {
|
|
594
|
+
BigInt64Array.prototype.set.call(getArrayI64FromWasm0(arg0, arg1), getObject(arg2));
|
|
595
|
+
},
|
|
314
596
|
__wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
|
|
315
597
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
316
598
|
},
|
|
599
|
+
__wbg_prototypesetcall_d49a4fab5ca427bc: function(arg0, arg1, arg2) {
|
|
600
|
+
Float64Array.prototype.set.call(getArrayF64FromWasm0(arg0, arg1), getObject(arg2));
|
|
601
|
+
},
|
|
602
|
+
__wbg_prototypesetcall_f8d32a400a944612: function(arg0, arg1, arg2) {
|
|
603
|
+
Int16Array.prototype.set.call(getArrayI16FromWasm0(arg0, arg1), getObject(arg2));
|
|
604
|
+
},
|
|
605
|
+
__wbg_push_2baf45db356cf468: function(arg0, arg1) {
|
|
606
|
+
const ret = getObject(arg0).push(getObject(arg1));
|
|
607
|
+
return ret;
|
|
608
|
+
},
|
|
317
609
|
__wbg_replace_89a2bb260816315a: function(arg0, arg1, arg2, arg3) {
|
|
318
610
|
const ret = getObject(arg0).replace(getObject(arg1), getStringFromWasm0(arg2, arg3));
|
|
319
611
|
return addHeapObject(ret);
|
|
@@ -331,6 +623,10 @@ function __wbg_get_imports() {
|
|
|
331
623
|
__wbg_setRequestHeader_733b74e99bf9b791: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
332
624
|
getObject(arg0).setRequestHeader(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
333
625
|
}, arguments); },
|
|
626
|
+
__wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
|
|
627
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
628
|
+
return ret;
|
|
629
|
+
}, arguments); },
|
|
334
630
|
__wbg_set_font_1f60a05a2544a2ff: function(arg0, arg1, arg2) {
|
|
335
631
|
getObject(arg0).font = getStringFromWasm0(arg1, arg2);
|
|
336
632
|
},
|
|
@@ -373,7 +669,12 @@ function __wbg_get_imports() {
|
|
|
373
669
|
const ret = arg0;
|
|
374
670
|
return addHeapObject(ret);
|
|
375
671
|
},
|
|
376
|
-
__wbindgen_generic_0000000000000002: function(arg0
|
|
672
|
+
__wbindgen_generic_0000000000000002: function(arg0) {
|
|
673
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
674
|
+
const ret = arg0;
|
|
675
|
+
return addHeapObject(ret);
|
|
676
|
+
},
|
|
677
|
+
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
377
678
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
378
679
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
379
680
|
return addHeapObject(ret);
|
|
@@ -406,17 +707,136 @@ function addHeapObject(obj) {
|
|
|
406
707
|
return idx;
|
|
407
708
|
}
|
|
408
709
|
|
|
710
|
+
function addBorrowedObject(obj) {
|
|
711
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
712
|
+
heap[--stack_pointer] = obj;
|
|
713
|
+
return stack_pointer;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
function debugString(val) {
|
|
717
|
+
// primitive types
|
|
718
|
+
const type = typeof val;
|
|
719
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
720
|
+
return `${val}`;
|
|
721
|
+
}
|
|
722
|
+
if (type == 'string') {
|
|
723
|
+
return `"${val}"`;
|
|
724
|
+
}
|
|
725
|
+
if (type == 'symbol') {
|
|
726
|
+
const description = val.description;
|
|
727
|
+
if (description == null) {
|
|
728
|
+
return 'Symbol';
|
|
729
|
+
} else {
|
|
730
|
+
return `Symbol(${description})`;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
if (type == 'function') {
|
|
734
|
+
const name = val.name;
|
|
735
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
736
|
+
return `Function(${name})`;
|
|
737
|
+
} else {
|
|
738
|
+
return 'Function';
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
// objects
|
|
742
|
+
if (Array.isArray(val)) {
|
|
743
|
+
const length = val.length;
|
|
744
|
+
let debug = '[';
|
|
745
|
+
if (length > 0) {
|
|
746
|
+
debug += debugString(val[0]);
|
|
747
|
+
}
|
|
748
|
+
for(let i = 1; i < length; i++) {
|
|
749
|
+
debug += ', ' + debugString(val[i]);
|
|
750
|
+
}
|
|
751
|
+
debug += ']';
|
|
752
|
+
return debug;
|
|
753
|
+
}
|
|
754
|
+
// Test for built-in
|
|
755
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
756
|
+
let className;
|
|
757
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
758
|
+
className = builtInMatches[1];
|
|
759
|
+
} else {
|
|
760
|
+
// Failed to match the standard '[object ClassName]'
|
|
761
|
+
return toString.call(val);
|
|
762
|
+
}
|
|
763
|
+
if (className == 'Object') {
|
|
764
|
+
// we're a user defined class or Object
|
|
765
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
766
|
+
// easier than looping through ownProperties of `val`.
|
|
767
|
+
try {
|
|
768
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
769
|
+
} catch (_) {
|
|
770
|
+
return 'Object';
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
// errors
|
|
774
|
+
if (val instanceof Error) {
|
|
775
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
776
|
+
}
|
|
777
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
778
|
+
return className;
|
|
779
|
+
}
|
|
780
|
+
|
|
409
781
|
function dropObject(idx) {
|
|
410
782
|
if (idx < 1028) return;
|
|
411
783
|
heap[idx] = heap_next;
|
|
412
784
|
heap_next = idx;
|
|
413
785
|
}
|
|
414
786
|
|
|
787
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
788
|
+
ptr = ptr >>> 0;
|
|
789
|
+
return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
function getArrayF64FromWasm0(ptr, len) {
|
|
793
|
+
ptr = ptr >>> 0;
|
|
794
|
+
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
function getArrayI16FromWasm0(ptr, len) {
|
|
798
|
+
ptr = ptr >>> 0;
|
|
799
|
+
return getInt16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
function getArrayI32FromWasm0(ptr, len) {
|
|
803
|
+
ptr = ptr >>> 0;
|
|
804
|
+
return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
function getArrayI64FromWasm0(ptr, len) {
|
|
808
|
+
ptr = ptr >>> 0;
|
|
809
|
+
return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
function getArrayI8FromWasm0(ptr, len) {
|
|
813
|
+
ptr = ptr >>> 0;
|
|
814
|
+
return getInt8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
function getArrayU16FromWasm0(ptr, len) {
|
|
818
|
+
ptr = ptr >>> 0;
|
|
819
|
+
return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
823
|
+
ptr = ptr >>> 0;
|
|
824
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
825
|
+
}
|
|
826
|
+
|
|
415
827
|
function getArrayU8FromWasm0(ptr, len) {
|
|
416
828
|
ptr = ptr >>> 0;
|
|
417
829
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
418
830
|
}
|
|
419
831
|
|
|
832
|
+
let cachedBigInt64ArrayMemory0 = null;
|
|
833
|
+
function getBigInt64ArrayMemory0() {
|
|
834
|
+
if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) {
|
|
835
|
+
cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer);
|
|
836
|
+
}
|
|
837
|
+
return cachedBigInt64ArrayMemory0;
|
|
838
|
+
}
|
|
839
|
+
|
|
420
840
|
let cachedDataViewMemory0 = null;
|
|
421
841
|
function getDataViewMemory0() {
|
|
422
842
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
@@ -425,10 +845,66 @@ function getDataViewMemory0() {
|
|
|
425
845
|
return cachedDataViewMemory0;
|
|
426
846
|
}
|
|
427
847
|
|
|
848
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
849
|
+
function getFloat32ArrayMemory0() {
|
|
850
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
851
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
852
|
+
}
|
|
853
|
+
return cachedFloat32ArrayMemory0;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
let cachedFloat64ArrayMemory0 = null;
|
|
857
|
+
function getFloat64ArrayMemory0() {
|
|
858
|
+
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
859
|
+
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
860
|
+
}
|
|
861
|
+
return cachedFloat64ArrayMemory0;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
let cachedInt16ArrayMemory0 = null;
|
|
865
|
+
function getInt16ArrayMemory0() {
|
|
866
|
+
if (cachedInt16ArrayMemory0 === null || cachedInt16ArrayMemory0.byteLength === 0) {
|
|
867
|
+
cachedInt16ArrayMemory0 = new Int16Array(wasm.memory.buffer);
|
|
868
|
+
}
|
|
869
|
+
return cachedInt16ArrayMemory0;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
let cachedInt32ArrayMemory0 = null;
|
|
873
|
+
function getInt32ArrayMemory0() {
|
|
874
|
+
if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
|
|
875
|
+
cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer);
|
|
876
|
+
}
|
|
877
|
+
return cachedInt32ArrayMemory0;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
let cachedInt8ArrayMemory0 = null;
|
|
881
|
+
function getInt8ArrayMemory0() {
|
|
882
|
+
if (cachedInt8ArrayMemory0 === null || cachedInt8ArrayMemory0.byteLength === 0) {
|
|
883
|
+
cachedInt8ArrayMemory0 = new Int8Array(wasm.memory.buffer);
|
|
884
|
+
}
|
|
885
|
+
return cachedInt8ArrayMemory0;
|
|
886
|
+
}
|
|
887
|
+
|
|
428
888
|
function getStringFromWasm0(ptr, len) {
|
|
429
889
|
return decodeText(ptr >>> 0, len);
|
|
430
890
|
}
|
|
431
891
|
|
|
892
|
+
let cachedUint16ArrayMemory0 = null;
|
|
893
|
+
function getUint16ArrayMemory0() {
|
|
894
|
+
if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {
|
|
895
|
+
cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);
|
|
896
|
+
}
|
|
897
|
+
return cachedUint16ArrayMemory0;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
let cachedUint32ArrayMemory0 = null;
|
|
901
|
+
function getUint32ArrayMemory0() {
|
|
902
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
903
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
904
|
+
}
|
|
905
|
+
return cachedUint32ArrayMemory0;
|
|
906
|
+
}
|
|
907
|
+
|
|
432
908
|
let cachedUint8ArrayMemory0 = null;
|
|
433
909
|
function getUint8ArrayMemory0() {
|
|
434
910
|
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
@@ -493,6 +969,8 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
493
969
|
return ptr;
|
|
494
970
|
}
|
|
495
971
|
|
|
972
|
+
let stack_pointer = 1024;
|
|
973
|
+
|
|
496
974
|
function takeObject(idx) {
|
|
497
975
|
const ret = getObject(idx);
|
|
498
976
|
dropObject(idx);
|
|
@@ -533,7 +1011,15 @@ function __wbg_finalize_init(instance, module) {
|
|
|
533
1011
|
wasmInstance = instance;
|
|
534
1012
|
wasm = instance.exports;
|
|
535
1013
|
wasmModule = module;
|
|
1014
|
+
cachedBigInt64ArrayMemory0 = null;
|
|
536
1015
|
cachedDataViewMemory0 = null;
|
|
1016
|
+
cachedFloat32ArrayMemory0 = null;
|
|
1017
|
+
cachedFloat64ArrayMemory0 = null;
|
|
1018
|
+
cachedInt16ArrayMemory0 = null;
|
|
1019
|
+
cachedInt32ArrayMemory0 = null;
|
|
1020
|
+
cachedInt8ArrayMemory0 = null;
|
|
1021
|
+
cachedUint16ArrayMemory0 = null;
|
|
1022
|
+
cachedUint32ArrayMemory0 = null;
|
|
537
1023
|
cachedUint8ArrayMemory0 = null;
|
|
538
1024
|
return wasm;
|
|
539
1025
|
}
|
package/basedpl_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bpl",
|
|
3
|
+
"scopeName": "source.bpl",
|
|
4
|
+
"fileTypes": [
|
|
5
|
+
"bpl"
|
|
6
|
+
],
|
|
7
|
+
"patterns": [
|
|
8
|
+
{
|
|
9
|
+
"begin": "⍝",
|
|
10
|
+
"beginCaptures": {
|
|
11
|
+
"0": {
|
|
12
|
+
"name": "comment.line.bpl"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"end": "$",
|
|
16
|
+
"contentName": "comment.line.bpl",
|
|
17
|
+
"patterns": [],
|
|
18
|
+
"applyEndPatternLast": true
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"begin": "\"",
|
|
22
|
+
"beginCaptures": {
|
|
23
|
+
"0": {
|
|
24
|
+
"name": "string.quoted.double.bpl"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"end": "\"|$",
|
|
28
|
+
"contentName": "string.quoted.double.bpl",
|
|
29
|
+
"patterns": [
|
|
30
|
+
{
|
|
31
|
+
"match": "\"\"",
|
|
32
|
+
"name": "string.quoted.double.bpl"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"applyEndPatternLast": true,
|
|
36
|
+
"endCaptures": {
|
|
37
|
+
"0": {
|
|
38
|
+
"name": "string.quoted.double.bpl"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"match": "'.?'",
|
|
44
|
+
"name": "string.quoted.single.bpl"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"match": "[A-Za-z_∆⍙][A-Za-z0-9_∆⍙]*(\\.[A-Za-z_∆⍙][A-Za-z0-9_∆⍙]*)*",
|
|
48
|
+
"name": "source.bpl"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"match": "•[A-Za-z_∆⍙][A-Za-z0-9_∆⍙]*",
|
|
52
|
+
"name": "support.function.system.bpl"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"match": "¯?∞|¯?(\\d+(\\.\\d+)?|\\.\\d+)([eEₑ]¯?\\d+)?([jJⱼ]¯?(\\d+(\\.\\d+)?|\\.\\d+)([eEₑ]¯?\\d+)?|ₓ|[rᵣ]¯?\\d+)?",
|
|
56
|
+
"name": "constant.numeric.bpl"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"match": "⍬ₓ?",
|
|
60
|
+
"name": "constant.numeric.bpl"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"match": "\\$[tfn]",
|
|
64
|
+
"name": "constant.numeric.bpl"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"match": "\\$[ad]",
|
|
68
|
+
"name": "string.quoted.double.bpl"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"begin": "[\\])](?=ₓ)",
|
|
72
|
+
"beginCaptures": {
|
|
73
|
+
"0": {
|
|
74
|
+
"name": "source.bpl"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"end": "[ₓ]|$",
|
|
78
|
+
"contentName": "constant.numeric.bpl",
|
|
79
|
+
"patterns": [],
|
|
80
|
+
"applyEndPatternLast": true,
|
|
81
|
+
"endCaptures": {
|
|
82
|
+
"0": {
|
|
83
|
+
"name": "constant.numeric.bpl"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"match": "[\\+\\-×÷⌈⌊\\|\\*⍟○π√!∧∨⊼⊽\\~=≠<≤>≥⍳:⍴≢≡,⍪⊂⊃⊆∊∪∩⍋⍒↑↓⌽⊖⍉⊤⊥⍎⍕⌷⌹\\#↕⍭⨸⌻⍸⍷⊢⊣¿]",
|
|
89
|
+
"name": "support.function.bpl"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"match": "[¨⍨⊗⌸∂/⌿\\\\⍀⁰¹²³⁴⁵⁶⁷⁸⁹⁻ᵀᵘ]",
|
|
93
|
+
"name": "keyword.operator.monadic.bpl"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"match": "[↣⍤∘⍠⍥↢\\.⍣⇄⊘⌾⍚@⌺]",
|
|
97
|
+
"name": "keyword.operator.dyadic.bpl"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"match": "[⍺⍵⍶⍹∇⍢]",
|
|
101
|
+
"name": "variable.parameter.bpl"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"match": "[←→⎕⋄\\?₀₁₂₃₄₅₆₇₈₉₋]",
|
|
105
|
+
"name": "keyword.control.bpl"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
package/canvas.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Draws a `•canvas` output on `canvas`. `json` holds the drawing function's JavaScript source, its options and its data. Each typed
|
|
2
|
+
// array in the data is `{$typed, offset, length}`, a view of `bytes`. The native build runs this script from the output's HTML. A page
|
|
3
|
+
// that shows the browser build's outputs calls it with the output's two entries.
|
|
4
|
+
(canvas, json, bytes) => {
|
|
5
|
+
const view = (_, v) => v?.$typed ? new globalThis[v.$typed](bytes.buffer, bytes.byteOffset + v.offset, v.length) : v;
|
|
6
|
+
const { source, options, data } = JSON.parse(json, view);
|
|
7
|
+
(0, eval)(source)(canvas.getContext('2d'), data, options);
|
|
8
|
+
}
|
package/input.js
CHANGED
|
@@ -73,8 +73,11 @@
|
|
|
73
73
|
if (python && c === '\\') i++;
|
|
74
74
|
else if (text.startsWith(quote, i)) { i += quote.length - 1; quote = ''; }
|
|
75
75
|
} else if (c === "'" && !python) {
|
|
76
|
-
if (i
|
|
77
|
-
|
|
76
|
+
if (text.startsWith("''", i) && !text.startsWith("'''", i)) i++;
|
|
77
|
+
else {
|
|
78
|
+
if (i + 2 >= text.length) return false;
|
|
79
|
+
i += 2;
|
|
80
|
+
}
|
|
78
81
|
} else if (c === "'" || c === '"') {
|
|
79
82
|
quote = python && text.startsWith(c.repeat(3), i) ? c.repeat(3) : c;
|
|
80
83
|
i += quote.length - 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "basedpl",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"description": "BasedPL, the Based-array Programming Language, is an APL-derived array language, borrowing ideas from J and BQN, with an emphasis on simple, consistent notation.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|