r/programming • • 1d ago

Wax: A User-Friendly Syntax for WebAssembly

https://tarides.com/blog/2026-11-26-wax/
63 Upvotes

8 comments sorted by

7

u/simon_o 1d ago

This will certainly be useful for people who felt that dealing with WAT for writing wasm manually was too cumbersome.

I just wish they hadn't faithfully copied over every syntactic paper-cut from Rust.

1

u/renatoathaydes 6h ago

I tried doing exactly that, but the WASM specs are hard for me to grok , and kept expanding over time, so unfortunately I never managed to get something useful. My language kept s-expressions but just made WAT look like a "normal" LISP-like language. I also wanted to have equivalence to the WASM binary format so you could generate any byte code you wanted precisely. Besides being a good target for compiling to WASM, I think that such language could be easily written by hand if it was pleasurable enough, and that would give a much nicer way to write WASM for web application that need performance, or even non-web applications, since once you have a WASM file you can easily run it with several non-browser runtimes as well as just compile to native for tiny binaries. For anything useful, you'll need WASI which is another rabbit hole though. Using AI, anyone can do that now, so I gave up and will just wait for someone else to spend the tokens :D.

4

u/imbev 1d ago

Why not https://www.assemblyscript.org/ or Rust with a WASM toolchain?

12

u/grayrest 1d ago

This is covered in the article. Author is implementing wasm support for OCaml, needs byte level control over the compilation target, and as a consequence is implementing features in bytecode. This is a semantically equal but less explicit rendering of the existing text format for wasm bytecode.

3

u/masklinn 1d ago

They’re not writing a classic wasm program / library, they’re writing the runtime support for ocaml’s wasm implementation.

Assemblyscript supports raw-ish wasm but it’s not the primary goal and is rough, and assemblyscript comes with (or requires) its own runtime.

Also this is 1:1 to the bytecode and standard text representations, which afaik is very much not the case for AS, or Rust.

1

u/Amber_Brown_938_0316 6h ago

Rust toolchain's a beast

1

u/lood9phee2Ri 5h ago

Nah, I strongly prefer sexp syntax.