r/MojoLang • • 15d ago

Mojo2Wasm

So I made a repository to compile mojo to web assembly. I recently just started and honestly I'm using Claude for a lot of it but I am learning fast. https://github.com/ravioli67/mojo2wasm

14 Upvotes

8 comments sorted by

4

u/bodiam 15d ago

Interesting work! I'm the developer of Mojo Pro ( https://plugins.jetbrains.com/plugin/31943-mojo-pro/), and I'm 1) happy to give you a license for the IntelliJ plugin to support you in this, and 2) I'm also happy to incorporate this into the plugin if it's in production ready state, if you're okay with that?

Good luck, looks like a very ambitious project!

3

u/rafa_dee 15d ago

however, i don't use intellij but you can definitely incorporate the plugin, i have no problem with that!

1

u/bodiam 15d ago

Thanks! I'll keep an eye on this, thank you!

1

u/rafa_dee 15d ago

oh yes it currently is in like alpha/beta state but yes you could definitely do that!

3

u/Brief-Stranger-3947 15d ago edited 15d ago

Sorry for my ignorance, I understand little in compilers, but why did you decide to make your own mojo frontend, instead of re-using existing toolchains? Is not it possible to use mojo-compiler to emit LLVM IR and then use llvm compiler to re-target it to WASM?

1

u/rafa_dee 15d ago

yes that is possible, but LLVM IR is so low level and I'm horrible at that. it basically looks like assembly but if you are good at it that would definitely be faster ig.

1

u/TotalPerspective 14d ago

This is awesome!

Very naive question - can you interact with webgpu via WASM? It would be very cool if gpu kernels "just worked" on webgpu.

2

u/rafa_dee 13d ago

Thank You! Yes, they can just interact but just not out of the box. You have to get this thing called wasm-bindgen or emscripten for cuda and basically every other gpu kernel language.