jamen/elixir-wasm

How can I build this or run it?

Closed this issue ยท 7 comments

Would be nice to get a few steps and simple tutorial in the readme.

I think the project is dead ๐Ÿ˜ข

jamen commented

Hey @justinmchase and @DanielRamosAcosta. This project is not usable yet. All this has right now is functions to encode WebAssembly's binary format. I was hoping I could get a prototype out sooner than later, but it's probably not going to happen.

This was my plan, if anyone is interested in picking up the slack:

  • Create erl_llvm to translate Erlang to LLVM.
  • Create erl_wasm from erl_llvm + Emscripten.
  • Create elixir-wasm by wrapping erl_wasm in a mix tasks.
  • Redo erl_wasm to translate BEAM directly to WebAssembly, while utilizing features like GC and threading, and creating more bindings to JS
  • Create demos demonstrating canvas, UIs, and such.

Cool! I was looking to make a redux-like state management POC in WASM I'll keep an eye on this.

rdrey commented

Here is someone else working on the step to LLVM: https://github.com/jamen/brewery - both of these projects would be amazing.

jamen commented

I actually own that repo too, but I kind of forgot about it and it should be removed.

What I was going to try and accomplish in brewery can be done with HiPE. So instead, I created erl_llvm as steps towards producing WASM with HiPE, llvm-link, and Emscripten.

But, what I found is it would work at times and most times it wouldn't. I think HiPE LLVM support is poor, or Emscripten is not as familiar with it and has trouble. So there is two ways you can go from there:

  1. Spend more time hacking HiPE + Emscripten prototype to reliably compile, then start working on the big BEAM to WASM compiler project.
  2. Don't waste time trying to hack together a barely working HiPE + Emscripten prototype, and just skip to trying to translate BEAM to WASM.

Also just remembered Emscripten and HiPE use different LLVM bytecode versions, but not sure that matters.

jamen commented

Started the compiler and its state, but it's still not usable and far from perfect. Probably fleshed out enough to create a Mix.Tasks.Compiler.Wasm here though.

If anyone wants to help the projects (or knows someone), I would be happy to reach out, collaborate, and accommodate changes. Would love to see this happen faster! ๐Ÿ˜ƒ

jamen commented

This library's purpose is now purely encoding, validating, and testing WebAssembly on Elixir (the WebAssembly analog to the elixir-estree library).

Instead, I want to focus on forking ElixirScript and adding WebAssembly to it, using these functions. This will help, because ElixirScript lays the foundation for the translation, and WebAssembly needs JavaScript to be useful inside the browser anyways.

I've continued the discussion here