WebAssembly is currently an important topic on the Web. Walt now provides an alternative syntax for the WebAssembly text format that is equivalent to JavaScript. This should make WebAssembly more accessible.
JavaScript with rules, Walt’s GitHub page describes the alternative syntax for WebAssembly. Walt provides a form of syntactic sugar for WebAssembly based on JavaScript that developers can use to dispense with the often-difficult syntax of
files. The choice fell on JavaScript, since not a completely new language was created, but an already familiar structure should be used. Walt compiles directly from known JavaScript syntax to WebAssembly bytecode. On GitHub, the following example code is given for a .walt module that generates a recursive fibronacci function:
export function fibonacci(n: i32): i32 {
if (n <= 0) return 0;
if (n == 1) return 1;
return fibonacci(n - 1) + fibonacci(n - 2);
}<
After compiling, a WebAssembly module can be created. Walt does not need its own compiler, but can be integrated into other build tools.
Walt: JavaScript for WebAssembly
As motivation for the development of Walt is stated that this is to facilitate the start of working with WebAssembly. In addition, Walt, for example, for Web and Node libraries can be used, whose performance should be improved by the use of WebAssembly. Also in the field of virtual and augmented reality on the Web, the developers of Walt see a potential application.
More information about Walt can be found on the GitHub page and in the wiki. There is also a demo that shows both the JavaScript code and the equivalent in WebAssembly.
Source: https://entwickler.de/online/javascript/walt-javascript-webassembly-579863399.html
The post Walt: JavaScript syntax adapted for WebAssembly appeared first on FrontNet Blog.