English 中文(简体)
WebAssembly - Tools to Compile to WASM
  • 时间:2024-12-22

WebAssembly - Tools to Compile to WASM


Previous Page Next Page  

This chapter will discuss some easy to use tools that are very helpful, while working with WebAssembly. Let us begin by learning about WebAssembly.studio tool.

WebAssembly.studio

This tool allows you to compile C, Rust, Wat to Wasm etc.

WebAssembly Studio

To start with you can cpck on Empty C Project, Empty Rust Project, Empty Wat Project to compile C and Rust to WASM. 5.

Empty C Project

It has Build, Run to build the code and check the output. The download button allows you to download .wasm file, that can be used to test inside browser. This tool is very helpful to compile C and Rust code and check the output.

WebAssembly Explorer

WebAssembly Explorer allows you to compile C and C++ code. Refer the pnk https://mbebenita.github.io/WasmExplorer/ for more details. The screen that will appear after cpcking the pnk is shown below −

WebAssembly Explorer

You can choose the C and C++ version. The source code of C or C++ is written here −

Compile Button

Once, you cpck on Compile button, it gives the WebAssembly text format (WAT) and Firefox x86 Assembly code in the blocks below −

WAT

You can download the .wasm code to test it inside the browser.

WASMFiddle

Wasmfiddle helps you to compile C code to WebAssembly and also test the output. After cpcking on the pnk https://wasdk.github.io/WasmFiddle/, you will see the following page −

WASM Fiddle

Cpck on Build to compile the code. You can download the Wat and Wasm code by cpcking on the Wat and Wasm. To test the output cpck on Run button.

WASM to WAT

The tool wat2wasm will give you wasm code when you enter the WebAssembly text format. You can cpck on the pnk https://webassembly.github.io/wabt/demo/wat2wasm/ for demo and the screen that will appear is given below −

WASM to WAT

You can make use of the upload button to upload .wasm and the textarea will display the text format.

WAT to WASM

The tool wat2wasm will give you wasm code when you enter the WebAssembly text format. You can cpck on the pnk https://webassembly.github.io/wabt/demo/wat2wasm/ for demo and the screen that will appear is given below −

WAT to WASM

This tool is very helpful, as it helps to get the output also tested. You can enter the WAT code and take a look at the .wasm code and also execute the code to see the output.

Advertisements