Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm learning the ins and outs of WebAssembly. I just picked back up writing my compiler to WASM for my toy programming language (think JS crossed with ML). Right now I'm getting a feel for writing stack based bytecode and implementing basic features like local variables and control flow. It's not much, but I just got factorial to compile in my language which felt totally awesome.


This sounds really neat. Do you have an open source repo for this? Would love to check it out. What framework are you using to write the compiler itself? LLVM, or something else?


Here's the repo: https://github.com/nicholaslyang/saber Fair warning, the code is quite gnarly.

I'm not using any frameworks. Took a bit to figure out code generating wasm, but once I got the basic emitter/IR working it got a little easier. Plus you start being able to read the binary format after a bit of practice.


Nice! FWIW I've been solving some wasm challenges in infosec Capture The Flag events and it's a nice way to learn the bytecode.


Cool! So far I've been reading the spec and looking at the output of wat2wasm.


I really like using Firefox's debugger -- you can step through bytecode as if it was JS.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: