Wa is a general-purpose programming language designed for developing robustness and maintainability WebAssembly software. Instead of requiring complex toolchains to set up, you can simply go install it - or run it in a browser.
Note: Our canonical Git repository is located at https://gitee.com/wa-lang/wa. There is a mirror of the repository at https://github.com/wa-lang/wa. Unless otherwise noted, the Wa source files are distributed under the AGPL-v3 license found in the LICENSE file.
https://wa-lang.org/playground
go install wa-lang.org/wa@latest
wa init -name=_examples/hi
wa run _examples/hi
The Wa project is still in very early stage. If you want to submit PR, please read the Contribution Guide(Chinese). We do not accept PR only about 3rdparty changes.
Print rune and call function:
# Copyright @2019-2022 The Wa author. All rights reserved.
import "fmt"
func main {
println("hello, Wa!")
println(add(40, 2))
fmt.Println(1+1)
}
func add(a: i32, b: i32) => i32 {
return a+b
}
Execute the program:
$ go run main.go hello.wa
hello, Wa!
42
2
Print prime numbers up to 30:
func main {
for n := 2; n <= 30; n = n + 1 {
var isPrime int = 1
for i := 2; i*i <= n; i = i + 1 {
if x := n % i; x == 0 {
isPrime = 0
}
}
if isPrime != 0 {
println(n)
}
}
}
Execute the program:
$ go run main.go run _examples/prime
2
3
5
7
11
13
17
19
23
29
More examples _examples
The Wa language itself can also be executed like the Lua language embedded in the Go host locale:
package main
import (
"fmt"
"wa-lang.org/wa/api"
)
func main() {
output, err := api.RunCode(api.DefaultConfig(), "hello.wa", code)
fmt.Print(string(output), err)
}
Note: Executing as a script currently only supports native environments.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.