| ▲ | Wax: A User-Friendly Syntax for WebAssembly(tarides.com) | |||||||||||||||||||||||||||||||||||||
| 97 points by theanonymousone 3 hours ago | 21 comments | ||||||||||||||||||||||||||||||||||||||
| ▲ | sheept 2 hours ago | parent | next [-] | |||||||||||||||||||||||||||||||||||||
Not super related, but I love that the text representation of wasm is named WAT, it feels like a callback to the infamous Javascript talk, Wat[0] | ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||
| ▲ | pcwalton an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||
Reminds me a bit of GCC's GIMPLE. For example: https://gcc.gnu.org/onlinedocs/gcc-4.2.3/gccint/GIMPLE-Examp... Unlike LLVM IR, which has a wildly different syntax from any other language, GCC's SSA IR was designed to look like a subset of C. There are some obvious benefits of doing it that way. Wasm can be even closer to a high level language because it has high level control flow... | ||||||||||||||||||||||||||||||||||||||
| ▲ | vertex_wharf an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||
Reverse direction is the only use-case I have. Previously I’ve used seqtk (via biowasm) in the browser to demo how to calculate GC content for a stats class. It works, but it’s a bit opaque in a way it wouldn’t be if I wrote the code in Python (can’t read the code before running it). Could use Wax for this (though need to check how good it is at decompiling modules compiled from C first). | ||||||||||||||||||||||||||||||||||||||
| ▲ | saghm an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||
I've been toying with using WASM as a way to expose custom scripting to expose to users, and because the product I'm working on already leans heavily into providing an agentic interface (which is both legitimately useful and sometimes a bit much...), and I've found that the agent seems pretty capable of writing valid WAT that fits the conventions described by the documentation that gets automatically fed into its context. It might be nice to have something more readable for me when trying to inspect what it creates, but on the other hand, apparently one of the product managers trying it out already decided to have his own agent just manually write JavaScript for him to look at and then map it to and from the WAT, which I'm not really convinced is a good experience for us to propose to customers, but I guess it works? | ||||||||||||||||||||||||||||||||||||||
| ▲ | julesrms 2 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||
Very nice. 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.. | ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||
| ▲ | gavinray 2 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||
This is essentially just Rust with the compile target set to WASM, though? 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 | ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||
| ▲ | kccqzy 2 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||
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. | ||||||||||||||||||||||||||||||||||||||
| ▲ | asibahi an hour ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||
Holy crap this is almost exactly what I was trying to go for in my own language. https://ar-ms.me/projects/quince/ I must check this in depth and steal ideas. | ||||||||||||||||||||||||||||||||||||||
| ▲ | boguscoder 2 hours ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||||||||
Good idea but AI bleeds through text so much it’s repelling. | ||||||||||||||||||||||||||||||||||||||
| ▲ | deklesen 2 hours ago | parent | prev [-] | |||||||||||||||||||||||||||||||||||||
Who the hell needs user-friendly syntax anymore? Sorry, but, ... | ||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||