Scope for Work on Racket -> WASM?

I'd like to know where we are at with compiling Racket to WASM. I have been planning to contribute to Racket, and I believe this one is something I'd really like to help with.

I know Adam Perlin has a Master's thesis on it and a RacketCon talk, but the repo looks like it's been off the burner for a while.

I tried to find ways for contacting Adam, but unfortunately couldn't trace an email or anything. Can others tell me, where can I get started with to take this work further towards upstreaming into Racket? I did see the build instructions and followed them, but I'm unsure where exactly to start with it. I don't see any issues or TODO section in the repository either.

I believe Racket can leverage a lot by compiling to WASM, similarly if not better than Guile's Hoot.

1 Like

There was a paper "rasm" about compiling racket to wasm. It posits that chez scheme, the language racket compiles to, could use some changes to better support a wasm backend.

Another option would be to directly target wasm instead of using chez scheme, as native code generation does.There is an alternative backend "Nora" that attempts to do this with llvm

Btw : i have a related thread WASM Proposal Lacks Support for Reusable Continuations

EDIT : i had provided the wrong link, fixed now

It looks like you've found everything there is to date. I'm not aware of any active projects to continue in this direction.

The biggest obstacle to a better implementation of Wasm seems still to be the mismatch between Chez Scheme's backend model, which is jump-oriented, and Wasm's block-structured control flow. The main options are (1) to post-process the output of Chez Scheme to convert an intermediate jump-oriented abstraction into Wasm, or (2) change Chez Scheme's compilation pipeline before the back end to have a different representation in the last steps. I don't know which of those directions will be the easiest way forward.

I would definitely recommend that anyone looking at this explore the Spritely Hoot project, at least for inspiration and possibly even for sharing code. While most of Guile is under the LGPL, the Hoot toolchain is Apache-2.0, just like Chez Scheme.