
A fast 100% spec compliant, self-hosted JavaScript parser - cheanrick
https://github.com/KFlash/seafox
======
Keverw
Interesting project. Wonder if this would be useful for web based programs
that could allow third party add-ons, etc... I was thinking WASM with some
bindings would be prefect, but being in JS itself sounds cool as this acts as
a sort of sandbox I'd imagined (Well I assume someone could try to make an
infinite loops and lock it up?). Be neat if could some how try to
limit/monitor memory and CPU usage.

~~~
lioeters
> web based programs that could allow third party add-ons

The library in the current post, Seafox - cute name! - is "just" the parser,
turning JavaScript code into an abstract syntax tree. One would need a
sandboxed interpreter/evaluator/virtual machine to run it.

You might be aware of Figma's efforts, where they compiled Fabrice Bellard's
QuickJS engine (in C) to WASM, to use for their plugin system.

[https://www.figma.com/blog/how-we-built-the-figma-plugin-
sys...](https://www.figma.com/blog/how-we-built-the-figma-plugin-system/)

[https://www.figma.com/blog/an-update-on-plugin-
security/](https://www.figma.com/blog/an-update-on-plugin-security/)

[https://bellard.org/quickjs/](https://bellard.org/quickjs/)

The first article describes an earlier system using Realms, a shim/polyfill
for an ECMAScript proposal.

[https://github.com/agoric/realms-shim/](https://github.com/agoric/realms-
shim/)

[https://github.com/tc39/proposal-realms](https://github.com/tc39/proposal-
realms)

------
mpoteat
These are pretty surprising claims... As far as I know, V8 itself is written
in C++, is this self-hosting parser faster than Node's parser?

~~~
jaquers
Fair point, though I read it like this, which doesn't make the claim _so_ bold
:)

> Twice as fast as other Javascript parsers (sic) written in JavaScript.

~~~
_bxg1
Yes, this was my interpretation too (should probably be made more clear). Most
JS dev tools are written in JS (Webpack, Babel, VSCode) so there's a large
use-case for a fast JS-native parser. It could also, theoretically, be run in-
browser for a macro system or something.

------
jdxcode
Is it possible to build an AST with v8 in JS?

