The content on this page is written in Chinese, and then traslated into English by machine. More accurate traslations are welcome at: https://github.com/wa-lang/man/tree/master/en

Ending's law: "Any application that can be compiled to WebAssembly, will be compiled to WebAssembly eventually."

1.2. Install Wa-lang Compiler

In addition to accessing the online Wa-lang playground, you can also install the compiler locally.

1.2.1 Install binaries

Download the latest binaries from Github: https://github.com/wa-lang/wa/releases. You need to ensure that it corresponds to the local platform. For example, on macOS/amd64, wa_0.8.1_darwin_amd64.tar.gz should be used.

The contents of the directory after decompression are as follows:

$ tree ./wa_0.8.1_darwin_amd64
./wa_0.8.1_darwin_amd64
├── LICENSE
├── README-zh.md
├── README.md
└── wa

1 directory, 5 files

Add the directory path to the system's PATH environment, then reopen the command line environment and execute the wa -v command to view the version information.

$ wa -v
Wa version v0.8.1

The first time you execute the wa command, a wa.wat2wasm.exe command will be generated in the same directory as the command.

The installation is now completed.

1.2.2 Install from source code

Installing from source requires installing Go1.17+ version, then execute the following command to install the latest Wa-lang compiler:

go install wa-lang.org/wa

It will be installed to the $HOME/go/bin directory by default, so this directory path needs to be added to the system's PATH environment. Then reopen the command line environment and execute the wa command once, the same help information as above will be output.

The first time you execute the wa -v command to view version information, a wa.wat2wasm.exe command will be generated in the same directory as the command.

The installation work is now completed.

1.2.3 Homebrew (MacOS & Linux)

For macOS and Linux systems, it can also be installed through Homebrew:

brew install wa-lang/tap/wa

1.2.4 Scoop (Windows)

For Windows systems, it can also be installed through Scoop:

scoop bucket add wa-lang https://github.com/wa-lang/scoop-bucket.git
scoop install wa-lang/wa

1.2.5 local Playground

After the Wa-lang compiler is successfully installed, enter wa play on the command line to open the local playground. The program will open the browser page by default, or you can enter the http://localhost:2023/ address to access. The effect is as follows:

Click the "Execute" button to see the output results.