cover image
Web

Top WebAssembly Languages

WebAssembly (Wasm) defines a portable binary-code format for executable programs. It can be used to run languages that support WebAssembly in the browser. Thus, you are no longer restricted to only use JavaScript in the browser. In this article, I want to show you which programming languages currently support WebAssembly.

C#

In the .Net area, Blazor is currently the product from Microsoft that offers interoperability between C# and JavaScript using WebAssembly. You can write frontend and backend applications only in C#. The frontend part runs on WebAssembly in the browser.

https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor

AssemblyScript

AssemblyScript is similar to TypeScript but compiles down to WebAssembly instead of JavaScript. Thus, for computation-heavy logic like image manipulation you could use AssemblyScript since the performance is better than similar TypeScript code.

https://www.assemblyscript.org

C / C++

Emscripten is a compiler that compiles C/C++ code into WebAssembly. It has been one of the first compilers to WebAssembly on the market.

https://emscripten.org

COBOL

COBOL is a business programming language that is still used in many legacy mainframe applications. The Cobweb project compiles COBOL via C to WebAssembly, making a wider use of this eminent language possible.

https://github.com/cloudflare/cobweb

D

The designers of the D programming languages wanted to make a "better C++". It is mostly used in system level programming. The compiler has an option to output to WebAssembly.

https://dlang.org/index.html

Faust

Faust is a functional programming language for sound synthesis and audio processing. It also supports WebAssembly.

https://faust.grame.fr

Go

Go is a statically compiled programming language with garbage collection and concurrency in mind. It supports WebAssembly.

https://go.dev

Pascal

Pascal is a procedural programming language designed by Niklaus Wirth. The Free Pascal compiler also has WebAssembly as a compilation target.

https://www.freepascal.org

PHP

PHP is a general purpose scripting language targeting web development. Currently, there is an effort to run PHP on WebAssembly. It is called "Wasmer PHP" and is hosted on GitHub.

https://github.com/wasmerio/wasmer-php

Python

Python is a high level, very popular general purpose programming language. The Pyodide distribution targets Python for the browser and Node using WebAssembly.

https://github.com/pyodide/pyodide

Rust

Rust is a multi-paradigm, general purpose programming language. Rust enforces memory safety and is popular for systems programming. Rust supports WebAssembly.

https://www.rust-lang.org

Swift

Swift is a compiled general purpose programming language developed by Apple. Using the SwiftWasm project you can compile Swift to WebAssembly.

https://swiftwasm.org

Conclusion

As you could see from the list above, there exist currently a multitude of programming languages that support WebAssembly. Thus, you are not stuck with only JavaScript on the browser but can use the language most appropriate for the task. With time, support for WebAssembly in programming languages probably will only grow larger.

References

Published 6 Nov 2022
Thomas Derflinger

Written by Thomas Derflinger

I am a visionary entrepreneur and software developer. In this blog I mainly write about web programming and related topics like IoT.