On Thursday, 14 October 2021 at 22:56:07 UTC, hatf0 wrote:
Hi all,
I've just managed to get the full DMD front-end to work in
WebAssembly (with skoppe's druntime fork). This doesn't do
code-gen or anything (but it potentially could?), and has some
OS-specific functionality stubbed out. No clue about GC --
haven't run into that issue, haven't thought about it yet!
You can find my work here if you're interested:
https://github.com/hatf0/dmd-fe-wasm-wrapper
This repo also serves as a semi-decent guide on how to get
started building files that target WebAssembly (specifically
WASI), if you're into that.
Oooh -- I totally forgot: for some reason, this doesn't work with
the wasmer JS runtime. I haven't done any investigation into it,
since it works just fine with the wasmer Rust runtime.
More work needs to be done before we can fully bring DMD to the
browser, but this could totally open up the idea of having
something like Swift Playgrounds within the browser (or perhaps
some toys like AST inspection, or whatnot).