16 Star 97 Fork 20

凹语言开发工作室 / 凹语言

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 3.77 KB
一键复制 编辑 原始数据 按行查看 历史
chai2010 提交于 2024-04-11 03:45 . 更新 readme

The Wa Programming Language

简体中文 | English

Build Status Coverage Status GitHub release license

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.

Playground

https://wa-lang.org/playground

Snake Game

NES emulator

WebGPU Demo

P5 for creative coding

Example: Print Wa

Print rune and call function:

import "fmt"

global year: i32 = 2023

func main {
	println("hello, Wa!")
	println(add(40, 2), year)

	fmt.Println(1+1)
}

func add(a: i32, b: i32) => i32 {
	return a+b
}

Execute the program:

$ wa run hello.wa 
hello, Wa!
42 2023
2

Example: Print Prime

Print prime numbers up to 30:

func main {
	for n := 2; n <= 30; n = n + 1 {
		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:

$ cd waroot && wa run -target=wasi examples/prime
2
3
5
7
11
13
17
19
23
29

Example: Print Prime with Chinese syntax

Print prime numbers up to 30:

引于 "书"

【启】:
  // 输出30以内的素数
  从n=2,到n>30,有n++:
    设素=1
    从i=2,到i*i>n,有i++:
      设x=n%i
      若x==0则:
        素=0


    若素!=0则:
      书·曰:n


Output is the same as the previous example.

More examples waroot/examples

Contributors

Contributor Contribution points
柴树杉 50000
丁尔男 58500
史斌 29000
扈梦明 28000
赵普明 18000
宋汝阳 2000
刘云峰 1000
王湘南 1000
王泽龙 1000
吴烜 3000
刘斌 2500
尹贻浩 2000
安博超 3000
yuqiaoyu 600
qstesiro 200
small_broken_gong 100
tk103331 100
Go
1
https://gitee.com/wa-lang/wa.git
git@gitee.com:wa-lang/wa.git
wa-lang
wa
凹语言
master

搜索帮助