Getting started with WebAssembly: writing and executing a simple program in Wat.

Let’s try WebAssembly for the first time. We will create a simple program in the Wat text format, compile it into Wasm binary, and finally execute it in a browser and as a server application.

This is the first part of a series about programming in WebAssembly (Wasm) for beginners. The goal is to give you the first impression of what Wasm is and how it can be beneficial for your own projects. The further the series goes the deeper we will delve into the topic.

I suppose you have already heard about WebAssembly; how performant, lightweight, secure, and overall promising it is. Otherwise, you probably would not be reading this text right now, would you? So, I will just skip all that fluff and go directly to the more interesting stuff: like how to write Wasm code and how to actually use it.

Wasm and Wat

Wasm is a binary format (files with the .wasm extension). It also has a textual representation called Wat (files with the .wat extension). Wat could easily be generated from the binary format, for example via developer tools in the browser.

Albeit Wat is a text format readable by humans, it is still pretty low-level — programming complex systems in Wat would quickly become a nightmare. But no worries, Wasm can be compiled from many languages like Rust, C/C++, Go, or Kotlin. Just choose your favourite one!

Hello, WebAssembly!

To understand the very basics we will start at quite a low-level. Well, not on the binary level, all in all, it was never meant to be written or read by humans. We will create a simple Hello world program in Wat, the WebAssembly text format.

#webassembly #web-development #programming #developer

Learning WebAssembly: Hello, World of Wasm!
1.90 GEEK