- Notifications
You must be signed in to change notification settings - Fork62
The Wa Programming Language
License
wa-lang/wa
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
- Home:https://wa-lang.github.io/
- Manual:https://wa-lang.github.io/man/en/
- Github:https://github.com/wa-lang/wa
- Playground:https://wa-lang.org/playground
Note: Unless otherwise noted, the Wa source files are distributed under the AGPL-v3 license found in the LICENSE file.
The project is still in the prototype stage. If you have co-construction or PR needs, please refer toHow to contribute. We no longer accept PRs for modifications to third-party libraries.
Note: Our canonical Git repository is located athttps://gitcode.com/wa-lang/wa. There is a mirror of the repository athttps://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 theWa Contributor Agreement(Aka WCA), but your PRs will not be reviewed or accepted until WCA is actually signed.
https://wa-lang.org/playground
- Wasm4/Snake:https://wa-lang.org/wa/w4-snake/
- Wasm4/2048:https://wa-lang.org/wa/w4-2048/
Print rune and call function:
import "fmt"global year: i32 = 2023func 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 20232
Print prime numbers up to 30:
func main {for n := 2; n <= 30; n = n + 1 {isPrime: int = 1for 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/prime2357111317192329
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.
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 exampleswaroot/examples
Contributor | Contribution points |
---|---|
柴树杉 | 99650 |
丁尔男 | 104150 |
史斌 | 10000 |
扈梦明 | 60000 |
赵普明 | 10000 |
宋汝阳 | 2000 |
刘云峰 | 1000 |
王潇南 | 1000 |
王泽龙 | 1000 |
吴烜 | 3000 |
刘斌 | 2500 |
尹贻浩 | 2000 |
安博超 | 3000 |
yuqiaoyu | 600 |
qstesiro | 200 |
small_broken_gong | 100 |
tk103331 | 100 |
蔡兴 | 3000 |
王任义 | 1000 |
imalasong | 2000 |
杨刚 | 4000 |
崔爽 | 2000 |
李瑾 | 20000 |
王委委 | 100 |
雪碧 | 100 |
If you like or are using Wa to learn or start your projects,please give it a star. Thanks!
About
The Wa Programming Language
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.