logoalt Hacker News

xienze • yesterday at 9:42 PM • 1 reply • view on HN

Well the problem with an alternate syntax like this is that it's not really 1:1 with WAT so it ends up being hard for you easily figure out how to derive an exact WAT form from your starting language. WAX wouldn't eliminate this problem.

What I've been doing is making a simple library that can build WASM instructions in memory which closely follows the syntax and semantics, and using my programming language of choice as basically a preprocessor that provides high level abstractions over raw WAT/WASM. That method is VERY amenable to optimization, either by hand or via LLM. Because you can run your code generation, figure out how the bytecode should change, and work backwards. And if you take care while writing it, it can be very easy to follow the code.


Replies

masklinn • yesterday at 9:52 PM

> Well the problem with an alternate syntax like this is that it's not really 1:1 with WAT

The author claims it is so and wax can be converted back and forth with wat or wasm bytecode. Do you have evidence to the contrary?

> What I've been doing is making a simple library that can build WASM instructions in memory which closely follows the syntax and semantics, and using my programming language of choice as basically a preprocessor that provides high level abstractions over raw WAT/WASM.

That is a completely different purpose unrelated to the goals of wax.

➕ show 1 reply