10 ms·
WASM Instructions
- andrea81 3y agoIs there a way to download the BNF as a single file so I can parse it?
- marianoguerra 3y agoYou can parse many things from this file, what are you trying to extract? https://github.com/WebAssembly/spec/blob/main/document/core/util/macros.def https://github.com/WebAssembly/spec/blob/main/document/core/...
- UncleEntity 3y agoThe grammar doesn't get you too far since the WASM is designed around a binary format. Plus they do some weird stuff around the names of the operators which has to be dealt with. That being said...https://pastebin.com/mhtgjSjZ https://pastebin.com/mhtgjSjZ
- pwdisswordfishc 3y ago> MathJax internal buffer size exceeded; is there a recursive macro call? That is so informative. Seriously though, wouldn't one expect the authors of this spec to be experts on web technologies who eat their own dog food (of web standards) instead of relying on a pale imitation of a dated typesetting technology like TeX?
- diggan 3y agoRather than jumping to conclusions, maybe a more favorable position would be to try to look into what's happening, before judging what others are doing/not doing? FWIW, it works perfectly fine for me on Linux with both Chrome and Firefox, so I'd say probably something is wonky in your environment, or a temporary issue on the website.
- burke 3y agoEven when it works (I’ve never seen this failure), this site is offensively unusable. Anchors don’t go to useful places; search doesn’t work in the MathJax regions… the writing also does a fairly poor job of communicating details in many cases. It’s really a truly terrible spec site.
- kevingadd 3y agoThe WASM spec ended up being a poor compromise between 'executable spec' (i.e. writing the spec entirely in ocaml or in a theorem prover language) and 'human readable spec' (i.e. the JavaScript or C# specs).
- mike_hock 3y ago> dated typesetting technology like TeX You seem to be confusing "mature" with "dated."
- pwdisswordfishc 3y agoNo, I am not. TeX, by itself, really shows its age, and how it was built as a "a faster horse" rather than hypertext's automobile: - despite the window dressing of LaTeX, it is ultimately presentation-oriented instead of structure-oriented; many widely-used forms of formatting markup rely on precise character dimensions and positioning; changing page dimensions may sometimes require fixes throughout the whole document - bad character set support: things like \mathcal{3} displays the wrong character WITH ZERO WARNING: see https://tex.stackexchange.com/q/84041/ https://tex.stackexchange.com/q/84041/ and duplicates - parsing is undecidable; the parser can be arbitrarily reconfigured at runtime, and can perform Turing-complete computations, which means processing arbitrary TeX code in any other way than to execute it as written is next to impossible; even a 100% correct syntax highlighter is unachievable MathJax fixes or ameliorates some of these flaws, but in trying to be compatible with TeX, it cannot avoid all of them; and in the meantime, it imposes its own syntax quirks and burdens the client with running bloated JavaScript, incurs significant pop-in latency, and leaves indecipherable mess of TeX code to clients which do not run JS. TeX is just PDF that's easier to edit, and MathJax is the Cufon of math markup. (Remember Cufon? Be thankful if you don't. Good riddance!)
- pests 3y agoWhat is the relevance for the stack exchange post? User was using \cal, they told him to use \mathcal. Or is it an issue still or?
- pwdisswordfishc 3y agoThe point is not in the mistake the user made, but how that error manifests. Subsequent punctuation characters that were not intended to be displayed in a different font are not kept as-is, nor do they trigger warnings like "character not present in font", but are instead substituted by random other characters. This is 1970s' "you're holding it wrong" error-handling philosophy, same one as C's. And yet Knuth seems to regard Unicode not as a basic building block of interoperability, but as useless bells-and-whistles, judging by his satirical "iTeX" presentation.
- RodgerTheGreat 3y agoOn the contrary: static documentation rendered via complex client-side code, producing seconds of visible pop-in and an atrocious user experience is entirely in line with the ethos of people who thought the web needed a more developer-convenient way of dumping huge opaque blobs of cross-compiled code into pages.
- pwdisswordfishc 3y agoPoint taken, I should have realized.
- pests 3y agoWhy create the document once on the server, when you can have your users generate it on-demand, on their device, every time they load the page! Imagine the cost savings.
- marwis 3y agoStrange choice to use MathJax when much better alternatives exist like KaTeX
- peter_d_sherman 3y agoRelated: "A fast Pascal (Delphi) WebAssembly interpreter": https://github.com/marat1961/wasm https://github.com/marat1961/wasm "WASM-4": https://github.com/aduros/wasm4 https://github.com/aduros/wasm4 "Curated list of awesome things regarding WebAssembly (wasm) ecosystem": https://github.com/mbasso/awesome-wasm https://github.com/mbasso/awesome-wasm Google Chromium/Chrome V8 (JavaScript Engine) WASM Source Code branch: https://github.com/v8/v8/tree/main/src/wasm https://github.com/v8/v8/tree/main/src/wasm Also... it would be nice if there was a WASM software/soft CPU for QEMU, which (if it existed!) would go here: https://github.com/qemu/qemu/tree/master/target https://github.com/qemu/qemu/tree/master/target
- GuestHNUser 3y agoOrca is also worth checking out. Still in development, but very usable. https://github.com/orca-app/orca https://github.com/orca-app/orca
- peter_d_sherman 3y agoExcellent link! I was looking for something exactly like that(!) to test running off-line (and out of the web browser) WASM code locally! Thanks extremely much!
- pxmpxm 3y agoI still entirely don't understand the point of web assembly - at best isn't it a pretend emulation layer? You have to have some sort translation layer/virtual machine consuming the fake assembly and spitting out the real hardware assembly... which begs the question of why is that better than mapping stuff into intrinsics. So far the only use case I can gather is obfuscation for content management a la tiktok, where as the people behind WASM seem to be going with the "super ~native performance" marketing angle.
- azangru 3y ago- Adobe has a C-based codebase of Photoshop developed over decades for the desktop app - Adobe wants to bring Photoshop to the web for easier distribution and tighter control - Adobe engineers compile the existing C-based codebase to webassembly instead of rewriting it from scratch in javascript - Photoshop for the Web is born - ... - Profit?
- pxmpxm 3y agoThat's great for the actual meat and potatoes, but like half of the codebase will be tied to whatever UX libraries (MFC on windows / Cocoa in osx) that won't port over. So you will be rewriting most of it in java script anyway? That argument feels a bit academic.
- whizzter 3y agoPartially, much of what makes Photoshop photoshop that clones can't replicate is the actual image manipulations,layer adjustments,etc that needs to be carrier over 1:1 or people will just be annoyed that it's not exactly right. Also Asm.JS (Wasm's predecessor) was born to port GAMES, games often have their own GL,etc UI's that they render themselves and then tons upon tons of gameplay logic code that runs in C/C++ (or whatever scripting language the engine supports like C#). That was the most important part initially, even if people on the outside are starting to benefit like the Figma folks that uses Wasm, kinda like GPU's were for gaming and now power a ton of modern UI and AI workloads.
- 3y ago
- marianoguerra 3y agoIf you are interested in learning about wasm instructions you may like https://wasmgroundup.com/ https://wasmgroundup.com/ > This book takes a hands-on, bottoms-up approach: you'll go from hand crafting bytecodes to writing a real compiler for a simple programming language. disclaimer: I'm the co-author
- emnudge 3y agoIf we’re doing self promo, I’ve got something similar but significantly smaller in scope: https://github.com/EmNudge/watlings https://github.com/EmNudge/watlings
- marianoguerra 3y agoLet's keep it going :D Writing a Minimum Viable Cartridge for WASM4 (https://wasm4.org/ https://wasm4.org/) using WAT: https://twitter.com/warianoguerra/status/1748382204508410149 https://twitter.com/warianoguerra/status/1748382204508410149 Wasm compilers in a tweet: https://twitter.com/warianoguerra/status/1576166873296941056 https://twitter.com/warianoguerra/status/1576166873296941056 A WebAssembly compiler for a reverse polish notation calculator in 269 bytes of JavaScript: https://twitter.com/warianoguerra/status/1677271664009138177 https://twitter.com/warianoguerra/status/1677271664009138177
- milliams 3y agoLook interesting. From the linked page. > This book takes a hands-on, bottoms-up approach I think you mean "bottom-up". "bottoms-up" is a toast.
- eru 3y agoPerhaps it's a pun?
- crabmusket 3y agoI worked through the chapters which were out when I bought late last year, and really enjoyed them! Haven't had the time to get deeper into it, but I really appreciated the examples of writing raw WASM binary with byte arrays. It really is from the ground up!
- ghusbands 3y agoThe use of MathJax for simple layouts that would easily work as HTML makes things a lot less usable for screen readers, for link behaviour, and for find-in-page.
- 01HNNWZ0MV43FF 3y agoYeah it's not gracefully degrading. I have JS disabled by default and it's just sigil spam. Couldn't they have an option like alt text where it shows something less pretty but useful before JS is on?
- beeboobaa 3y agoDisabling standard features of your webbrowser leads to a degraded experience. Who could have seen that coming?
- gumby 3y agoAre jumps unrestricted or block only? ISTR in the first draft of WASM it was impossible to write continuation-passing code, coroutines, or even tail call.
- cornstalks 3y agoBlock only. There’s a tail call proposal[1] that’s in phase 4 (nearly standardized). [1]: https://github.com/WebAssembly/proposals https://github.com/WebAssembly/proposals
- azakai 3y agoNote that phase 4 is the final stage of the standard process. Tail calls are at phase 4, which means that is a finalized and complete standard. All that is left after that is for VMs to implement the standard, which is tracked here: https://webassembly.org/features/ https://webassembly.org/features/ Most major VMs do support tail calls today, but not all.
- sestep 3y agoAlso note that that webpage can be somewhat out of date; for instance, see here for some recent edits to it (e.g. features Node had implemented that were marked as unavailable): https://github.com/WebAssembly/website/commits/main/ https://github.com/WebAssembly/website/commits/main/
- marianoguerra 3y agoThere's a proposal for effect handlers that allows for continuatios, coroutines and others. > effect handlers as a unifying mechanism to enable efficient compilation of control idioms, such as async/await, generators/iterators, first-class continuations, etc. https://wasmfx.dev/ https://wasmfx.dev/
- gumby 3y agoSo a coroutine would be a “stack” one frame deep?
- sestep 3y agoNote that this page doesn't currently include instructions from WasmGC which is starting to become supported in some engines; that spec can be found here: https://webassembly.github.io/gc/core/syntax/instructions.html https://webassembly.github.io/gc/core/syntax/instructions.ht...
- marianoguerra 3y agoFor a full list of proposals you can check https://github.com/WebAssembly/proposals https://github.com/WebAssembly/proposals
- ilaksh 3y agoOne thing I didn't realize for awhile is that it's not actually an assembly language. At least not in a traditional way. Because it is high level, with things like loop and if-else, etc. I assume it was initially intended to be more like a "real" assembly language but then they realized how much more optimized things could be if they went with higher level constructs.
- capitainenemo 3y agoWell, it grew out of ASM.js, so not really an accident. https://en.wikipedia.org/wiki/WebAssembly https://en.wikipedia.org/wiki/WebAssembly "the initial implementation was based on the feature set of asm.js." https://en.wikipedia.org/wiki/Asm.js https://en.wikipedia.org/wiki/Asm.js NaCL tried more to be a real assembly language but had cross-platform issues.
- pjmlp 3y agoHence why PNaCL came to be.
- capitainenemo 3y agoHuh. I thought PNaCL had cross-platform endian issues from what I'd read at the time. However: https://www.tomshardware.com/news/chrome-deprecates-pnacl-embraces-webassembly,34583.html https://www.tomshardware.com/news/chrome-deprecates-pnacl-em... Just mentions API concerns and: https://robert.ocallahan.org/2013/05/blink-pnacl-and-standards.html?gad_source=1 https://robert.ocallahan.org/2013/05/blink-pnacl-and-standar... " PNaCl and Pepper are not open standards, and there are not even any proposals on the table to standardize them in any forum. They have documentation, but for the details one must defer to the large bundle of Chrome code that implements them. " and "1. NaCl is CPU-specific. That's not suitable for the web. 2. PNaCl is in theory portable, so it is potentially worth considering. 3. However there is no spec for PNaCl, and standardizing it would take an extreme amount of effort: It means standardizing a subset of LLVM IR, which is quite rich and complex, as well as the Pepper plugin API. This is an enormous amount of work that has not even been begun by Google AFAIK." But you're right, I don't see anyone mentioning any hardware complications. Oh well. Moot point these days, and I think we're all better off that everyone else stood their ground, in terms of security, integration with JS APIs, and having a variety of WASM implementations.
- flykespice 3y agoThe website seems not to be rendering correctly, at least on my phone.