porffor 0.50.24 → 0.50.25
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 +3 -4
- package/compiler/index.js +0 -4
- package/package.json +1 -1
- package/runner/index.js +1 -1
- package/compiler/diagram.js +0 -31
package/README.md
CHANGED
@@ -98,8 +98,9 @@ Porffor can run Test262 via some hacks/transforms which remove unsupported featu
|
|
98
98
|
|
99
99
|
## Codebase
|
100
100
|
- `compiler`: contains the compiler itself
|
101
|
-
- `
|
102
|
-
- `
|
101
|
+
- `builtins`: built-in apis written in typescript
|
102
|
+
- `2c.js`: custom wasm-to-c engine
|
103
|
+
- `allocator.js`: static/compile-time allocator
|
103
104
|
- `assemble.js`: assembles wasm ops and metadata into a spec-compliant wasm module/file
|
104
105
|
- `builtins.js`: all manually written built-ins of the engine (spec, custom. vars, funcs)
|
105
106
|
- `builtins_object.js`: all the various built-in objects (think `String`, `globalThis`, etc.)
|
@@ -107,7 +108,6 @@ Porffor can run Test262 via some hacks/transforms which remove unsupported featu
|
|
107
108
|
- `codegen.js`: code (wasm) generation, ast -> wasm. The bulk of the effort
|
108
109
|
- `cyclone.js`: wasm partial constant evaluator (it is fast and dangerous hence "cyclone")
|
109
110
|
- `decompile.js`: basic wasm decompiler for debug info
|
110
|
-
- `diagram.js`: produces [Mermaid](https://mermaid.js.org) graphs
|
111
111
|
- `embedding.js`: utils for embedding consts
|
112
112
|
- `encoding.js`: utils for encoding things as bytes as wasm expects
|
113
113
|
- `expression.js`: mapping most operators to an opcode (advanced are as built-ins eg `f64_%`)
|
@@ -131,7 +131,6 @@ Porffor can run Test262 via some hacks/transforms which remove unsupported featu
|
|
131
131
|
- `compile.js`: compiles regex ast into wasm bytecode aot
|
132
132
|
- `parse.js`: own regex parser
|
133
133
|
|
134
|
-
- `test`: contains many test files for majority of supported features
|
135
134
|
- `test262`: test262 runner and utils
|
136
135
|
|
137
136
|
## Usecases
|
package/compiler/index.js
CHANGED
@@ -9,7 +9,6 @@ import toc from './2c.js';
|
|
9
9
|
import * as pgo from './pgo.js';
|
10
10
|
import cyclone from './cyclone.js';
|
11
11
|
import './prefs.js';
|
12
|
-
import * as Diagram from './diagram.js';
|
13
12
|
|
14
13
|
globalThis.decompile = decompile;
|
15
14
|
|
@@ -188,9 +187,6 @@ export default (code, module = undefined) => {
|
|
188
187
|
}
|
189
188
|
};
|
190
189
|
print(data);
|
191
|
-
|
192
|
-
// const url = Diagram.url(Diagram.tree(data));
|
193
|
-
// console.log(`built-in tree: ${url}`);
|
194
190
|
}
|
195
191
|
|
196
192
|
if (logProgress) progressStart('assembling...');
|
package/package.json
CHANGED
package/runner/index.js
CHANGED
package/compiler/diagram.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
export const tree = data => {
|
2
|
-
let out = 'flowchart LR\n';
|
3
|
-
let ids = new Map();
|
4
|
-
|
5
|
-
const run = (x, parent = null) => {
|
6
|
-
for (const [ name, children ] of x) {
|
7
|
-
const alreadyHas = ids.has(name);
|
8
|
-
if (!alreadyHas) ids.set(name, ids.size);
|
9
|
-
const id = ids.get(name);
|
10
|
-
|
11
|
-
if (!alreadyHas || parent != null) {
|
12
|
-
if (parent != null) out += `${parent}-->`;
|
13
|
-
out += `${id}${alreadyHas ? '' : `["${name}"]`}\n`;
|
14
|
-
}
|
15
|
-
|
16
|
-
if (children) run(children, id);
|
17
|
-
}
|
18
|
-
};
|
19
|
-
run(data);
|
20
|
-
|
21
|
-
return out;
|
22
|
-
};
|
23
|
-
|
24
|
-
export const url = code => `https://mermaid.live/view#${btoa(JSON.stringify({
|
25
|
-
mermaid: code.length > 10000 ? { theme: 'dark', securityLevel: 'loose', maxEdges: 5000 } : { theme: 'dark' },
|
26
|
-
updateDiagram: true,
|
27
|
-
autoSync: true,
|
28
|
-
rough: false,
|
29
|
-
panZoom: true,
|
30
|
-
code
|
31
|
-
}))}`;
|