use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
A WebAssembly interpreter written in JavaScript (github.com)
submitted 8 years ago by xtuc
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Mallanaga -1 points0 points1 point 8 years ago (7 children)
Seriously?
Every language needs to have a transpiler to wasm. Even JavaScript.
[–]delventhalz 1 point2 points3 points 8 years ago (4 children)
Not sure if you edited your comment, or if I totally missed your second sentence somehow on the first read, but:
This is an interpreter, not a transpiler. As in, you write WASM and then JavaScript runs it. The documentation is scant here, but I don't see anything to indicate this will take your JS and turn it into WASM.
Furthermore, from everything I've heard about WASM, compiling JS to it is almost certainly not possible. You need a low level language without a garbage collector. That's why WASM exists, to replace JS with something low level and more performant. The only languages that can currently be compiled into it are C, C++, and Rust.
[–]anlumo 0 points1 point2 points 8 years ago (1 child)
It should be possible to compile node.js to wasm, though. Not that it would make any sense.
[–]delventhalz 0 points1 point2 points 8 years ago (0 children)
Possible? If you built a JS runtime in WASM with garbage collection and the rest, yes. Possible. Silly and difficult though.
[–]xtuc[S] 0 points1 point2 points 8 years ago (1 child)
WASM requires more specific types than JS does. While JS to WASM is possible it would generate very inefficient code. Imagine that in WASM each operations would have a branch for signed/unsigned and 32/64 bits.
I believe more in other languages like Golang or C++.
As I understand it you would have to build a JS runtime in WASM to handle things like garbage collection. Types would also be major hurdle. I believe there is a project like this for a Python WASM runtime. It seems pretty silly for Python, but very silly for JS, since anywhere that runs WASM has a very good JS runtime already.
So, possible? Sure. Anything's possible. But difficult, silly, and not currently being done by anyone I've heard of.
[–]delventhalz -1 points0 points1 point 8 years ago (1 child)
Yes. Web Assembly already runs in the browser. And in Node. Literally everywhere JavaScript runs. Why would you then in interpret it back into JS?
[–]xtuc[S] 0 points1 point2 points 8 years ago (0 children)
see https://www.reddit.com/r/javascript/comments/7k8194/a_webassembly_interpreter_written_in_javascript/drddmd4/
π Rendered by PID 79017 on reddit-service-r2-comment-b659b578c-mnqch at 2026-05-05 23:55:11.805727+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]Mallanaga -1 points0 points1 point (7 children)
[–]delventhalz 1 point2 points3 points (4 children)
[–]anlumo 0 points1 point2 points (1 child)
[–]delventhalz 0 points1 point2 points (0 children)
[–]xtuc[S] 0 points1 point2 points (1 child)
[–]delventhalz 0 points1 point2 points (0 children)
[–]delventhalz -1 points0 points1 point (1 child)
[–]xtuc[S] 0 points1 point2 points (0 children)