2 min read

Walt, an alternative syntax for WebAssembly text format, was introduced today. It allows developers to use JavaScript syntax to write to as “close to the metal” as possible. Its ultimate goal is to make WebAssembly accessible to regular JavaScript programmers. Written 100% in JavaScript it requires no LLVM/binary toolkits.

What Walt tries to solve?

Writing zero-overhead, optimized WebAssembly code is difficult. You need to write very plain C code, compile that to .wast and then optimize that result. Then, finally, you’re ready to compile that into the final WebAssembly binary. Walt attempts to take C/Rust out of the equation and write “as close to the metal” as possible without losing readability.

How it solves the problem?

What Walt does is, it provides a thin layer of syntax sugar on top of .wat text format. This improved syntax will give developers direct control over the WebAssembly output. This means that there should be minimal to none post optimization to be done to the wast code generated.

For example, here is what a .walt module, which exports a recursive Fibonacci function, looks like:

Fibonacci

Source: GitHub

When this code is passed through the Walt compiler, you get a buffer which can be used to create a WebAssembly module with a fibonacci export. Al this is done with familiar JS syntax and without any external binary toolkits.

What are some of its use cases?

Anyone who is interested in WebAssembly but is not familiar with system languages can get a quick start with Walt. It can be used in the following scenarios:

  • Web/Node libraries
  • Games
  • Web VR/ AR
  • Projects depending on heavy real-time computation from complex UIs to 3D visualizations

To know more about Walt and how you can get started with it, check out its GitHub repository.

Read Next

Introducing Wasmjit: A kernel mode WebAssembly runtime for Linux

Unity Benchmark report approves WebAssembly load times and performance in popular web browsers

Why is everyone going crazy over WebAssembly?


Subscribe to the weekly Packt Hub newsletter. We'll send you the results of our AI Now Survey, featuring data and insights from across the tech landscape.

* indicates required