logo
0
0
WeChat Login
be20_在cnb_yml配置使用golang镜像

The Wa Programming Language

简体中文 | English

Build Status Coverage Status GitHub release license CNCF Landscape

Wa (Chinese name "凹", which pronounced "Wa") is a general-purpose programming language designed for for WebAssembly. The goal is to provide a simple, reliable, easy-to-use, statically typed language for high-performance web applications. The code generator and runtime are fully independently developed (not dependent on external projects such as LLVM). Currently, Wa is in the engineering trial stage.

Note: The Wa compiler source files are distributed under the AGPL-v3 license. The Wa standard library is licensed under the MIT license. The programs you develop using the Wa language can be safely used commercially without open source. If you want to integrate the Wa compiler code into your own project, but do not want to be restricted by the infectiousness of AGPL-v3, you can contact us to customize the license agreement for you.

How to contribute

The project is still in the prototype stage. If you have co-construction or PR needs, please refer to How to contribute. We no longer accept PRs for modifications to third-party libraries.

Note: Our canonical Git repository is located at https://gitcode.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.

Note: Submitting a PR to this repository is deemed to be your recognition and acceptance of the Wa Contributor Agreement(Aka WCA), but your PRs will not be reviewed or accepted until WCA is actually signed.

Playground

https://wa-lang.org/playground

Snake Game

WASM4 Game

NES emulator

WebGPU Demo

P5 for creative coding

Arduino Nano 33

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.

Example: Chrome Native AI

Chrome builtin Gemini Nano Demo:

import "ai"

func main {
	ai.RequestSession(func(session: ai.Session){
		session.PromptAsync("Who are you?", func(res: string) {
			println(res)
		})
	})
}

More examples waroot/examples

Contributors

ContributorContribution points
柴树杉99650
丁尔男104150
史斌10000
扈梦明60000
赵普明10000
宋汝阳2000
刘云峰1000
王潇南1000
王泽龙1000
吴烜3000
刘斌2500
尹贻浩2000
安博超3000
yuqiaoyu600
qstesiro200
small_broken_gong100
tk103331100
蔡兴3000
王任义1000
imalasong2000
杨刚4000
崔爽2000
李瑾20000
王委委100
雪碧100

Contact us

Email: dev{AT}wa-lang.org

About

https://gitcode.com/wa-lang/wa.git 凹语言 | 因为简单,所以自由

21.11 MiB
0 forks0 stars5 branches41 TagREADMEAGPL-3.0 license
Language
Go83.8%
JavaScript11.3%
CSS1.3%
C0.5%
Others3.1%