TLDR; I tried compiling Js to webassembly, and I failed.
When I started learning about compilers, the first thing that I wanted to do was, compile javascript to native code. My personal motivation has always been to experiment with compilation of javascript and how it turns out ? Compiling something to a native code and that also for multiple processors, is not an easy task. Then I paused that idea for a moment. I started learning about webassembly out of no where, and got intrigued by the idea of compiling javascript to webassembly. Webassembly for me, sounded like a perfect target for native compilation.
It is both stack based and register based bytecode standard, so once you write the code, you could run it anywhere with the help of webassembly vm. While the original idea was to support the native compilation for javascript, webassembly brought me closer to that because of its lowlevel bytecode format.
Why WebAssembly?
WebAssembly was one of the hottest things in the town. I was reading blogs from Figma and other tech companies migrating their code from asm.js to webassembly, and how fast their software become, ofcourse with some tradeoffs. It has lowlevel bytecodes format, which makes it closer to assembly. And also, using bytecode format would make things faster for the cpu for making calculations, mostly for games and image processing engines.