> This is essentially just Rust with the compile target set to WASM, though?
It's not rust at all, it's a rust-like representation of wasm bytecode.
> WASM Text (WAT) is not really meant to be human-authored, it's an IR representation, like LLVM IR.
Which is exactly why TFA wrote an alternate representation, they're writing the runtime for a wasm target so they specifically want to craft their bytecode, and WAT is not a great thing to write.
Having done a bit of staring-at-WASM while building a compiler, I never stopped being annoyed by the question of who came up with that terrible parentheses syntax. I could never see how it made any sense for any use-case.
Obviously the very top-level parser for the parenthesis stuff is simpler than a parser for a more complex syntax like Wax's. But that is a tiny part of the parser's job, and the savings are marginal. Just because you start by parsing the text into a simple node tree, you still have to check that tree against the implicit syntax that you're expecting it to conform to, and a lot of that checking could have been avoided by pushing it into the actual syntax of a nicer language. They already have a binary format, so the whole point of this text format is to be human-readable, which it absolutely isn't. So the compromise it makes to make the parser very slightly simpler just seems mad to me. Anyway, end of rant..
There’s a lot of people, myself included, who quite like s-expressions. And it’s not all that surprising that WAT is LISPy given JavaScript was originally intended to be a LISP too.
As the essay notes, wat was mostly designed as a pretty printer, not necessarily a pretty one but one which would be clear to the compiler writer, such that they could cross-check and debug their codegen.
This reminded me of a JIT project where pieces of code were directly written in LLVM IR. This is of course a terribly masochistic way of programming.
It took a build system expert in that project to finally allow the build system to express the concept of compiling C++ to Bitcode which is then used by JIT.
If you mean AI use, then AIs will benefit from it as well, like from multiple angles, direct and indirect. It can also inspire other ideas or tooling around it, move the whole ecosystem forward if it gains traction.
It can be a great learning tool or aid, like if you're trying to deepen you comprehension of WASM, being able to toggle between multiple formats (one of which is relatively familiar to most Devs) can help speed that up by a lot.
Even if you're someone who never even looks at the code their LLM spits out, all the big LLMs are trained on way more rust code than lisps, so it stands to reason they will likely do better with a rust-like syntax.
WASM Text (WAT) is not really meant to be human-authored, it's an IR representation, like LLVM IR.
The one genuine use I could see out of this is the ability to go backwards, from WAT -> High-level language
It's not rust at all, it's a rust-like representation of wasm bytecode.
> WASM Text (WAT) is not really meant to be human-authored, it's an IR representation, like LLVM IR.
Which is exactly why TFA wrote an alternate representation, they're writing the runtime for a wasm target so they specifically want to craft their bytecode, and WAT is not a great thing to write.
[0]: https://www.destroyallsoftware.com/talks/wat
Having done a bit of staring-at-WASM while building a compiler, I never stopped being annoyed by the question of who came up with that terrible parentheses syntax. I could never see how it made any sense for any use-case.
Obviously the very top-level parser for the parenthesis stuff is simpler than a parser for a more complex syntax like Wax's. But that is a tiny part of the parser's job, and the savings are marginal. Just because you start by parsing the text into a simple node tree, you still have to check that tree against the implicit syntax that you're expecting it to conform to, and a lot of that checking could have been avoided by pushing it into the actual syntax of a nicer language. They already have a binary format, so the whole point of this text format is to be human-readable, which it absolutely isn't. So the compromise it makes to make the parser very slightly simpler just seems mad to me. Anyway, end of rant..
There’s a lot of people, myself included, who quite like s-expressions. And it’s not all that surprising that WAT is LISPy given JavaScript was originally intended to be a LISP too.
It took a build system expert in that project to finally allow the build system to express the concept of compiling C++ to Bitcode which is then used by JIT.
It can be a great learning tool or aid, like if you're trying to deepen you comprehension of WASM, being able to toggle between multiple formats (one of which is relatively familiar to most Devs) can help speed that up by a lot.
Lots of reasons to make things user friendly