Go to file
chai2010 83585ee274 补充 wasi 函数 2023-03-19 08:01:58 +08:00
.github/workflows Github 不接受 PR 2023-02-02 21:55:44 +08:00
.workflow gitee 流水线完善 2023-02-04 15:55:02 +08:00
_examples 初步支持单元测试 2023-03-18 07:07:12 +08:00
api main 强制导入 runtime 包 2023-03-14 23:41:00 +08:00
docs feat: optimized style 2023-01-03 20:33:49 +08:00
internal 补充 wasi 函数 2023-03-19 08:01:58 +08:00
.gitignore 支持 os.Args 2023-03-11 07:36:22 +08:00
CONTRIBUTORS Create CONTRIBUTORS 2022-11-02 23:09:03 +08:00
LICENSE 启用 AGPLv3 协议 2022-10-20 21:18:55 +08:00
Makefile 本地增加 arduino 模拟执行 2022-11-27 15:45:13 +08:00
README-zh.md 更新 readme 2023-03-12 07:47:40 +08:00
README.md 更新 readme 2023-03-12 07:47:40 +08:00
arduino.wa 调整注释合规, 中文别名关键字后面空格可省 2023-01-26 22:16:11 +08:00
brainfuck.wa 调整注释合规, 中文别名关键字后面空格可省 2023-01-26 22:16:11 +08:00
changelog.md 更新 changelog 2023-03-18 15:48:19 +08:00
go.mod deps: updates wazero to 1.0.0-pre.4 (#41) 2022-12-03 14:52:09 +08:00
go.sum deps: updates wazero to 1.0.0-pre.4 (#41) 2022-12-03 14:52:09 +08:00
hello.wa 调整注释合规, 中文别名关键字后面空格可省 2023-01-26 22:16:11 +08:00
logo.ico windows 增加 exe 图标 2022-09-30 08:17:23 +08:00
main.go 单元测试模式准备工作, 解析测试代码 2023-03-15 23:52:27 +08:00
main.rc windows 增加 exe 图标 2022-09-30 08:17:23 +08:00
main_rc_windows.syso windows 增加 exe 图标 2022-09-30 08:17:23 +08:00

README.md

The Wa Programming Language

简体中文 | English

Build Status Go Report Card Coverage Status GitHub release Go Reference 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

Install and Run:

Go >= 1.17

  1. go install wa-lang.org/wa@latest
  2. wa init -name=_examples/hi
  3. 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.

Example: Print Wa

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

Example: Print Prime

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