porffor 0.2.0-fde989a → 0.2.0-fdf0fc5

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.
Files changed (58) hide show
  1. package/CONTRIBUTING.md +256 -0
  2. package/LICENSE +20 -20
  3. package/README.md +123 -85
  4. package/asur/README.md +2 -0
  5. package/asur/index.js +1262 -0
  6. package/byg/index.js +237 -0
  7. package/compiler/2c.js +1 -1
  8. package/compiler/{sections.js → assemble.js} +63 -15
  9. package/compiler/builtins/annexb_string.js +72 -0
  10. package/compiler/builtins/annexb_string.ts +18 -0
  11. package/compiler/builtins/array.ts +149 -0
  12. package/compiler/builtins/base64.ts +76 -0
  13. package/compiler/builtins/boolean.ts +20 -0
  14. package/compiler/builtins/crypto.ts +120 -0
  15. package/compiler/builtins/date.ts +2070 -0
  16. package/compiler/builtins/escape.ts +141 -0
  17. package/compiler/builtins/function.ts +7 -0
  18. package/compiler/builtins/int.ts +147 -0
  19. package/compiler/builtins/number.ts +534 -0
  20. package/compiler/builtins/object.ts +6 -0
  21. package/compiler/builtins/porffor.d.ts +59 -0
  22. package/compiler/builtins/set.ts +5 -0
  23. package/compiler/builtins/string.ts +1080 -0
  24. package/compiler/builtins.js +435 -279
  25. package/compiler/{codeGen.js → codegen.js} +1034 -404
  26. package/compiler/decompile.js +0 -1
  27. package/compiler/embedding.js +22 -22
  28. package/compiler/encoding.js +108 -10
  29. package/compiler/generated_builtins.js +1526 -0
  30. package/compiler/index.js +25 -34
  31. package/compiler/log.js +6 -3
  32. package/compiler/opt.js +50 -36
  33. package/compiler/parse.js +33 -23
  34. package/compiler/precompile.js +128 -0
  35. package/compiler/prefs.js +27 -0
  36. package/compiler/prototype.js +27 -42
  37. package/compiler/types.js +38 -0
  38. package/compiler/wasmSpec.js +28 -8
  39. package/compiler/wrap.js +51 -46
  40. package/package.json +9 -5
  41. package/porf +2 -0
  42. package/rhemyn/compile.js +46 -27
  43. package/rhemyn/parse.js +322 -320
  44. package/rhemyn/test/parse.js +58 -58
  45. package/runner/compare.js +34 -34
  46. package/runner/debug.js +122 -0
  47. package/runner/index.js +78 -11
  48. package/runner/profiler.js +102 -0
  49. package/runner/repl.js +42 -9
  50. package/runner/sizes.js +37 -37
  51. package/compiler/builtins/base64.js +0 -92
  52. package/filesize.cmd +0 -2
  53. package/runner/info.js +0 -89
  54. package/runner/profile.js +0 -46
  55. package/runner/results.json +0 -1
  56. package/runner/transform.js +0 -15
  57. package/tmp.c +0 -661
  58. package/util/enum.js +0 -20
@@ -1,15 +0,0 @@
1
- import compile from '../compiler/wrap.js';
2
- import fs from 'node:fs';
3
-
4
- const file = process.argv.slice(2).find(x => x[0] !== '-');
5
-
6
- const source = fs.readFileSync(file, 'utf8');
7
-
8
- const { wasm } = await compile(source);
9
-
10
- // const out = `(async () => { const print = str => process.stdout.write(str); (await WebAssembly.instantiate(Uint8Array.from([${wasm.toString()}]), {'': { p: i => print(i.toString()), c: i => print(String.fromCharCode(i))}})).instance.exports.m()})()`;
11
- // const out = `new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([${wasm.toString()}])),{'':{p:i=>process.stdout.write(i.toString())}}).exports.m()`;
12
- const out = `const a=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([${wasm.toString()}])));const b=a.exports.m();console.log(Array.from(new Uint16Array(a.exports.$.buffer,b+4,new Int32Array(a.exports.$.buffer,b,1))).map(x=>String.fromCharCode(x)).join(''))`;
13
-
14
- console.log(out);
15
- eval(out);