11 AssemblyScript
AssemblyScript is a high-level language explicitly designed to compile to WebAssembly or WAT. AssemblyScript is more expressive than WAT but can compile to it. When you use AssemblyScript, you lose some of the fine optimization control that you have with WAT, but it’s much faster to write.
We’ll begin this chapter by creating a simple AddInt
s
function, like the AddInt
one we created in Chapter 1. We’ll write an AssemblyScript hello world app and compile it into WAT to see the WebAssembly that the AssemblyScript compiler generates. We’ll examine AssemblyScript’s use of length-prefixed strings, and then install the AssemblyScript ...
Get The Art of WebAssembly now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.