TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Jaws – a JavaScript to WASM ahead-of-time compiler

290 pointsby drogus7 months ago
I've open sourced a JavaScript to WASM compiler. It's an experimental tool, but given the semantics I already implemented, I'm fairly certain I am able to eventually cover 100% of JavaScript spec. Any ideas, questions or critique welcomed! If you are interested in WASM, especially with new proposals like WASM GC or exception handling, it might be a good source of seeing these features in action - the project has a few thousand lines of hand written WAT so far.

18 comments

andout_7 months ago
Really clever use of the new WASM GC proposal. All the JS -> WASM compilers so far have basically just been shipping a whole JS engine - this is the first one I've seen that actually tries to map JS constructs directly to WASM primitives.
评论 #42097891 未加载
评论 #42097220 未加载
mmoskal7 months ago
Back in the day I did an almost-Typescript (though much closer than assembly script) to embedded ARM compiler. Some of the techniques may be useful.<p><a href="https:&#x2F;&#x2F;www.microsoft.com&#x2F;en-us&#x2F;research&#x2F;uploads&#x2F;prod&#x2F;2019&#x2F;09&#x2F;static-typescript-draft2.pdf" rel="nofollow">https:&#x2F;&#x2F;www.microsoft.com&#x2F;en-us&#x2F;research&#x2F;uploads&#x2F;prod&#x2F;2019&#x2F;0...</a>
评论 #42096778 未加载
owenpalmer7 months ago
&gt; As much as I love writing Rust, I also know it&#x27;s not a widely popular language<p>Is this true? Rust is hyped like crazy and seems to be used everywhere these days.
评论 #42097801 未加载
评论 #42097655 未加载
kengoa7 months ago
&gt; I&#x27;m fairly certain I am able to eventually cover 100% of JavaScript spec. Any ideas, questions or critique welcomed!<p>Do you have the results of test262_runner.rb? I came to know about test262 at a talk by the porffor&#x27;s author and something like <a href="https:&#x2F;&#x2F;github.com&#x2F;CanadaHonk&#x2F;porffor?tab=readme-ov-file#test262">https:&#x2F;&#x2F;github.com&#x2F;CanadaHonk&#x2F;porffor?tab=readme-ov-file#tes...</a> in README would be great to show this progress. Great project by the way!
评论 #42096766 未加载
OscarDC7 months ago
I read the README.md of the project but I&#x27;m still not sure: What&#x27;s the expected usage of this? How does the outputed WASM code then interacts with a runtime (and with which, is it intended to be a tool compatible with browsers and other WASM runtimes or is it only compatible with a runtime linked to the project)?<p>Somewhat linked questions: How does it react if it encounters e.g. web APIs inside the JavaScript code or other global identifiers only defined in some environment (e.g. a recent browser, Node.js etc.)? Or if it&#x27;s not intended for those environments, how are you supposed to do I&#x2F;O when using this?
评论 #42096288 未加载
samuelstros7 months ago
nice, &quot;run JS without (browser) runtime&quot; is coming. perforr, jaws, or another project will eventually succeed.
评论 #42096084 未加载
评论 #42098049 未加载
评论 #42096736 未加载
评论 #42096073 未加载
spankalee7 months ago
I really like this approach. Building for WASM directly, rather than trying to also directly generate binaries, means you can rely on WASM GC and the async support that (I think?) is supposed to be part of WASI 0.3.
0xfffafaCrash6 months ago
How are string encoding discrepancies and related utilities dealt with? My vague understanding is that WASM supports UTF-8 while JS supports (potentially malformed) UTF-16
评论 #42098888 未加载
tomcam7 months ago
Or, as some of us call it, a compiler. Nice work btw!
评论 #42097362 未加载
pier257 months ago
So does this execute faster than just running the same code in js or is this for interop for other languages?
评论 #42102791 未加载
teaearlgraycold7 months ago
I get a build error where it can not find &quot;prepend.js&quot;. Indeed it appears to not be in the repo.
评论 #42097245 未加载
dmitry-vsl7 months ago
Does it implement JS standard library, for example Map, Set etc?
lagrange777 months ago
Very cool!<p>Does it support ArrayBuffers?
评论 #42096377 未加载
huijzer7 months ago
Just when I was thinking: do we need more compilers or do they all exist already?<p>Thank you for working on this! I think it’s a great idea.
评论 #42097356 未加载
k__6 months ago
Can you make it deterministic?
philipwhiuk7 months ago
We&#x27;re one step closer: <a href="https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;the-birth-and-death-of-javascript" rel="nofollow">https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;the-birth-and-death...</a>
评论 #42096726 未加载
评论 #42096751 未加载
Aldipower7 months ago
JAWS is a well-known screen reader for blind people with a more then 30 years history.
评论 #42096341 未加载
评论 #42096340 未加载
评论 #42096745 未加载
asabla7 months ago
Title might need to include &quot;Show HN&quot;.<p>Very cool and interesting project! How are build times? And how big are the artifacts?<p>I&#x27;ll for sure keep an eye on this, and add it to my ever expanding list of tech to explore.<p>Thank you for sharing!
评论 #42096105 未加载
评论 #42096024 未加载