porffor 0.2.0-c1ed50d → 0.2.0-c56b8bf
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 +20 -9
- package/compiler/builtins/date.ts +721 -85
- package/compiler/builtins.js +2 -5
- package/compiler/codegen.js +34 -0
- package/compiler/generated_builtins.js +288 -0
- package/compiler/index.js +1 -2
- package/compiler/prefs.js +1 -1
- package/fib.js +7 -0
- package/package.json +1 -1
- package/runner/index.js +10 -0
package/README.md
CHANGED
@@ -151,24 +151,28 @@ These include some early (stage 1/0) and/or dead (last commit years ago) proposa
|
|
151
151
|
- Array member setting (`arr[0] = 2`, `arr[0] += 2`, etc)
|
152
152
|
- Array constructor (`Array(5)`, `new Array(1, 2, 3)`)
|
153
153
|
- Labelled statements (`foo: while (...)`)
|
154
|
-
- `do...while`
|
154
|
+
- `do...while` loops
|
155
155
|
|
156
156
|
### Built-ins
|
157
157
|
|
158
|
-
- `NaN` and `Infinity`
|
159
|
-
- `isNaN()` and `isFinite()`
|
160
|
-
- Most of `Number` (`MAX_VALUE`, `MIN_VALUE`, `MAX_SAFE_INTEGER`, `MIN_SAFE_INTEGER`, `POSITIVE_INFINITY`, `NEGATIVE_INFINITY`, `EPSILON`, `NaN`, `isNaN`, `isFinite`, `isInteger`, `isSafeInteger`)
|
161
|
-
- Some `Math` funcs (`sqrt`, `abs`, `floor`, `sign`, `round`, `trunc`, `clz32`, `fround`, `random`)
|
158
|
+
- `NaN` and `Infinity`
|
159
|
+
- `isNaN()` and `isFinite()`
|
160
|
+
- Most of `Number` (`MAX_VALUE`, `MIN_VALUE`, `MAX_SAFE_INTEGER`, `MIN_SAFE_INTEGER`, `POSITIVE_INFINITY`, `NEGATIVE_INFINITY`, `EPSILON`, `NaN`, `isNaN`, `isFinite`, `isInteger`, `isSafeInteger`)
|
161
|
+
- Some `Math` funcs (`sqrt`, `abs`, `floor`, `sign`, `round`, `trunc`, `clz32`, `fround`, `random`)
|
162
162
|
- Basic `globalThis` support
|
163
163
|
- Basic `Boolean` and `Number`
|
164
164
|
- Basic `eval` for literals
|
165
165
|
- `Math.random()` using self-made xorshift128+ PRNG
|
166
166
|
- Some of `performance` (`now()`, `timeOrigin`)
|
167
|
-
- Some of `Array.prototype` (`at`, `push`, `pop`, `shift`, `fill`)
|
167
|
+
- Some of `Array.prototype` (`at`, `push`, `pop`, `shift`, `fill`, `slice`, `indexOf`, `lastIndexOf`, `includes`, `with`, `reverse`, `toReversed`)
|
168
168
|
- Some of `Array` (`of`, `isArray`)
|
169
|
-
-
|
169
|
+
- Most of `String.prototype` (`at`, `charAt`, `charCodeAt`, `toUpperCase`, `toLowerCase`, `startsWith`, `endsWith`, `indexOf`, `lastIndexOf`, `includes`, `padStart`, `padEnd`, `substring`, `substr`, `slice`, `trimStart`, `trimEnd`, `trim`, `toString`, `big`, `blink`, `bold`, `fixed`, `italics`, `small`, `strike`, `sub`, `sup`, `trimLeft`, `trimRight`, )
|
170
170
|
- Some of `crypto` (`randomUUID`)
|
171
171
|
- `escape`
|
172
|
+
- `btoa`
|
173
|
+
- Most of `Number.prototype` (`toString`, `toFixed`, `toExponential`)
|
174
|
+
- `parseInt`
|
175
|
+
- Spec-compliant `Date`
|
172
176
|
|
173
177
|
### Custom
|
174
178
|
|
@@ -272,8 +276,6 @@ No particular order and no guarentees, just what could happen soon™
|
|
272
276
|
- Run precompiled Wasm file if given
|
273
277
|
- Docs
|
274
278
|
- Update codebase readme section
|
275
|
-
- REPL
|
276
|
-
- Basic polyfill of `node:repl` for non-Node runtimes to work
|
277
279
|
- Cool proposals
|
278
280
|
- [Optional Chaining Assignment](https://github.com/tc39/proposal-optional-chaining-assignment)
|
279
281
|
- [Modulus and Additional Integer Math](https://github.com/tc39/proposal-integer-and-modulus-math)
|
@@ -293,6 +295,15 @@ No particular order and no guarentees, just what could happen soon™
|
|
293
295
|
## VSCode extension
|
294
296
|
There is a vscode extension in `vscode-ext` which tweaks JS syntax highlighting to be nicer with porffor features (eg highlighting wasm inside of inline asm).
|
295
297
|
|
298
|
+
## Wasm proposals used
|
299
|
+
Porffor intentionally does not use Wasm proposals which are not commonly implemented yet (eg GC) so it can be used in as many places as possible.
|
300
|
+
|
301
|
+
- Multi-value **(required)**
|
302
|
+
- Non-trapping float-to-int conversions **(required)**
|
303
|
+
- Bulk memory operations (required, but uncommonly used)
|
304
|
+
- Exception handling (optional, for errors)
|
305
|
+
- Tail calls (opt-in, off by default)
|
306
|
+
|
296
307
|
## Isn't this the same as AssemblyScript/other Wasm langs?
|
297
308
|
No. they are not alike at all internally and have very different goals/ideals:
|
298
309
|
- Porffor is made as a generic JS engine, not for Wasm stuff specifically
|