
A book about WebAssembly by @warianoguerra & @dubroy — learn Wasm by building a simple compiler in JavaScript. 🦋 https://xitter.cf/t.co/8DBbR7dWj6
- Tweets103
- Following30
- Followers347
- Likes13

ALT A table of contents page for 'WebAssembly from the Ground Up' with a purple 'WA' logo. The page is divided into sections: Start, Main Track, Deep Dives, and Finish. The Main Track section includes topics like 'Minimum Viable Compiler', 'Writing a Compiler with Ohm', and several other chapters including two bonus sections marked with sparkle emojis. Some entries in the Deep Dives and Finish sections are marked as 'Draft'. A cartoon pair of eyes appears in the bottom right corner with a pink arrow pointing to the 'Conclusion' section.

ALT A conclusion page from a WebAssembly book, titled 'Conclusion' with the subtitle 'What we covered (and what we didn't)'. The text discusses the book's focus on WebAssembly Core Specification 1.0, listing four main topics covered: the execution model, binary module format (.wasm), validation rules, and text format (.wat). The text explains that the book primarily focused on the first two topics while acknowledging that not everything could be covered comprehensively.

ALT "A table of contents showing the structure of a technical book or guide about compilers and programming. The content is divided into sections: START (with Introduction and About the Code), MAIN TRACK (containing topics like Minimum Viable Compiler, Writing a Compiler with Ohm, and various programming concepts), DEEP DIVES (with technical topics like Variable-Length Integer Encoding), and FINISH (with Conclusion and final sections). Some entries are marked as 'Draft' or 'Planned'. There's a pink arrow pointing to 'Appendix: Odds & Ends' with text saying 'The last technical chapter!!!'"

ALT A documentation page about WebAssembly global variables. The left side shows a navigation menu with sections like 'Odds and Ends', 'Export types', and 'Global variables'. The main content includes explanatory text and two code blocks in dark mode. The first code block shows global instruction definitions in JavaScript with hexadecimal values (0x23 and 0x24). The second code block contains more complex JavaScript code defining global section constants and functions, including SECTION_ID_GLOBAL set to 6, mutation types, and helper functions for handling global variables. The code is syntax-highlighted in shades of blue and white

ALT Arrays and Strings In the last chapter, we added basic support to Wafer for reading and writing linear memory. We can now create modules with memory, and access it directly as if it was a single big array of i32 values. Our first goal in this chapter is to use that functionality to add support for regular, dynamically-allocated i32 arrays. In order to do that, we’ll need to write a simple memory allocator. Then, building on i32 arrays, we’ll add support for strings to Wafer — which means we’ll finally be able to write “Hello, world!”

ALT Bounds checking We can make our arrays more user friendly by implementing bounds checking. That is, before reading or writing memory, we’ll check that the index is valid — that it’s within the bounds of the array. The way we’ll do that is by storing the array length at the beginning of every array. So an array of length 2 will now take up three i32 slots: one for the length, and two for the entries themselves.












