提交 88551636 编写于 作者: 3 3dgen

Merge branch 'master' of https://github.com/wa-lang/wa

<div align="center">
<p>
<img width="80" src="https://raw.githubusercontent.com/wa-lang/wa/master/docs/images/logo/logo-round.svg?sanitize=true">
</p>
<h1>🇨🇳 凹语言™ The Wa Programming Language</h1>
[主页](https://wa-lang.org) | [Playground](https://wa-lang.org/playground) | [目标](https://wa-lang.org/goals.html) | [路线](https://wa-lang.org/smalltalk/st0002.html) | [社区](https://wa-lang.org/community) | [日志](https://wa-lang.org/changelog.html) | [论坛](https://github.com/wa-lang/wa/discussions)
[Document](https://wa-lang.org) | [Playground](https://wa-lang.org/playground) | [Goals](https://wa-lang.org/goals.html) | [Roadmap](https://wa-lang.org/smalltalk/st0002.html) | [Community](https://wa-lang.org/community) | [Changelog](https://wa-lang.org/changelog.html) | [Discussions](https://github.com/wa-lang/wa/discussions)
</div>
<div align="center">
......@@ -16,42 +16,26 @@
</div>
凹语言™(凹读音“Wa”)是 [柴树杉](https://github.com/chai2010)[丁尔男](https://github.com/3dgen)[史斌](https://github.com/benshi001) 针对 WASM 平台设计的的通用编程语言,支持 Linux、macOS 和 Windows 等主流操作系统和 Chrome 等浏览器环境,同时也支持作为独立Shell脚本和被嵌入脚本模式执行。
凹语言™(凹读音“Wa”)是 针对 WASM 平台设计的的通用编程语言,支持 Linux、macOS 和 Windows 等主流操作系统和 Chrome 等浏览器环境,同时也支持作为独立Shell脚本和被嵌入脚本模式执行。
开发组成员:[柴树杉](https://github.com/chai2010)[丁尔男](https://github.com/3dgen)[史斌](https://github.com/benshi001)[扈梦明](https://github.com/xxxDeveloper)[刘云峰](https://github.com/leaftree)
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.
```
+---+ +---+
| o | | o |
| +----+ |
| |
| Wa |
| |
+------------+
```
![](docs/images/logo/logo-animate1-blue.svg)
- 主页 (Homepage): [https://wa-lang.org](https://wa-lang.org)
- 开发工具 (Develop Tools): [Playground](https://wa-lang.org/playground), [VSCode](https://marketplace.visualstudio.com/items?itemName=xxxDeveloper.vscode-wa)
- 开发组 (Core Team): [柴树杉(chai2010)](https://github.com/chai2010)[丁尔男(Ending)](https://github.com/3dgen)[史斌(Benshi)](https://github.com/benshi001)[扈梦明(xxxDeveloper)](https://github.com/xxxDeveloper)[刘云峰(leaftree)](https://github.com/leaftree)
安装和测试:
安装和测试 (Install and Run):
1. `go install github.com/wa-lang/wa@latest`
2. `wa init -name=_examples/hi`
3. `wa run _examples/hi`
> 项目尚处于原型开源阶段,如果有共建和PR需求请 [入群交流](https://wa-lang.org/community/index.html)。
> [VS Code 插件支持](https://marketplace.visualstudio.com/items?itemName=xxxDeveloper.vscode-wa)
## 例子: 凹语言 (Example: Print 凹语言)
## 设计目标
- 披着 Go 语法外衣的 C 语言;
- 凹语言™源码文件后缀为 `.wa`
- 凹语言™编译器兼容 WaGo 语法。WaGo 是 Go 真子集。使用 WaGo 语法的源码文件后缀为 `.wa.go`。凹语法与 WaGo 语法在 AST 层面一致;
- 凹语言™支持中文/英文双语关键字,即任一关键字均有中文及英文版,二者在语法层面等价。
更多细节请参考 [凹语言™项目目标](docs/goals.md)
## 例子: 你好, 凹语言
打印字符和调用函数:
打印字符和调用函数(Print rune and call function):
```
fn main() {
......@@ -68,7 +52,7 @@ fn add(a: i32, b: i32) => i32 {
}
```
运行并输出结果:
运行并输出结果 (Execute the program):
```
$ go run main.go hello.wa
......@@ -76,9 +60,9 @@ $ go run main.go hello.wa
42
```
## 例子: 打印素数
## 例子: 打印素数 (Example: Print Prime)
打印 30 以内的素数
打印 30 以内的素数 (Print prime numbers up to 30):
```
# 版权 @2021 凹语言™ 作者。保留所有权利。
......@@ -98,7 +82,7 @@ fn main() {
}
```
运行并输出结果:
运行并输出结果 (Execute the program):
```
$ go run main.go run _examples/prime
......@@ -114,11 +98,11 @@ $ go run main.go run _examples/prime
29
```
更多例子 [_examples](_examples)
更多例子 (More examples) [_examples](_examples)
## 作为脚本执行
## 作为脚本执行 (Execut as a script)
凹语言本身也可以像 Lua 语言被嵌入 Go 宿主语言环境执行
凹语言本身也可以像 Lua 语言被嵌入 Go 宿主语言环境执行 (The Wa language itself can also be executed like the Lua language embedded in the Go host locale):
```go
package main
......@@ -134,9 +118,8 @@ func main() {
}
```
注:作为脚本执行目前只支持本地环境。
## 版权
注:作为脚本执行目前只支持本地环境。(Note: Executing as a script currently only supports native environments.)
版权 @2019-2022 凹语言™ 作者。保留所有权利。
## 版权(License)
版权 @2019-2022 凹语言™ 作者。保留所有权利。(Copyrighe @2019-2022 The Wa author. All rights reserved.)
# 版本日志
- v0.2.1 (2022-09-16)
- 支持纯浏览器编译执行: [https://wa-lang.org/playground](https://wa-lang.org/playground)
- 命令行增加打印 logo 子命令
- 本地支持被嵌入脚本模式执行
- 修复格式化问题
- v0.2.0 (2022-09-07)
- 全面切换到 WAT 后端, 支持 Linux/macOS/Windows 平台
- 简化命令行字命令, 不依赖任何第三方工具
......
<!--
// 版权 @2019 凹语言 作者。保留所有权利。
// https://github.com/wa-lang
-->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" width="400" height="400" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="M50 70C50 58.9543 58.9543 50 70 50H130C141.046 50 150 58.9543 150 70V74V130V150H250V130V74V70C250 58.9543 258.954 50 270 50H330C341.046 50 350 58.9543 350 70V94V130V330C350 341.046 341.046 350 330 350H70C58.9543 350 50 341.046 50 330V130V94V70Z" fill="blue" />
<circle cx="100" cy="100" r="5" stroke="black" stroke-width="0" fill="white">
<animate attributeName="r" values="0;5;5;0" dur="1s" repeatCount="1" />
</circle>
<circle cx="300" cy="100" r="5" stroke="black" stroke-width="0" fill="white">
<animate attributeName="r" values="0;5;5;0" dur="1s" repeatCount="1" />
</circle>
<path d="M200 230L234 264L268 230M200 230L166 264L132 230" stroke="white" stroke-width="8" stroke-linecap="round" stroke-dasharray="0,0,0,192">
<animate attributeType="XML" attributeName="stroke-dasharray" values="0,0,0,192;0,96,96,0; 192,0,0,0" keyTimes="0; 0.5;1" fill="freeze" dur="1.5s" repeatCount="1" />
</path>
</svg>
\ No newline at end of file
<!--
// 版权 @2019 凹语言 作者。保留所有权利。
// https://github.com/wa-lang
-->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" width="400" height="400" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="M50 70C50 58.9543 58.9543 50 70 50H130C141.046 50 150 58.9543 150 70V74V130V150H250V130V74V70C250 58.9543 258.954 50 270 50H330C341.046 50 350 58.9543 350 70V94V130V330C350 341.046 341.046 350 330 350H70C58.9543 350 50 341.046 50 330V130V94V70Z" fill="LightSeaGreen" />
<circle cx="100" cy="100" r="5" stroke="black" stroke-width="0" fill="white">
<animate attributeName="r" values="0;5;5;0" dur="1s" repeatCount="1" />
</circle>
<circle cx="300" cy="100" r="5" stroke="black" stroke-width="0" fill="white">
<animate attributeName="r" values="0;5;5;0" dur="1s" repeatCount="1" />
</circle>
<path d="M200 230L234 264L268 230M200 230L166 264L132 230" stroke="white" stroke-width="8" stroke-linecap="round" stroke-dasharray="0,0,0,192">
<animate attributeType="XML" attributeName="stroke-dasharray" values="0,0,0,192;0,96,96,0; 192,0,0,0" keyTimes="0; 0.5;1" fill="freeze" dur="1.5s" repeatCount="1" />
</path>
</svg>
\ No newline at end of file
<!--
// 版权 @2019 凹语言 作者。保留所有权利。
// https://github.com/wa-lang
-->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400" width="400" height="400" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="M50 70C50 58.9543 58.9543 50 70 50H130C141.046 50 150 58.9543 150 70V74V130V150H250V130V74V70C250 58.9543 258.954 50 270 50H330C341.046 50 350 58.9543 350 70V94V130V330C350 341.046 341.046 350 330 350H70C58.9543 350 50 341.046 50 330V130V94V70Z" fill="LightSeaGreen">
<animateMotion path="M 0 0 v 30 Z" dur="0.8s" repeatCount="indefinite" />
</path>
<path stroke="none" fill="white" d="M100,100 m-5,-5 h10 v10 h-10">
<animateMotion path="M 0 0 v 30 Z" dur="0.8s" repeatCount="indefinite" />
</path>
<path stroke="none" fill="white" d="M400,100 m-100,0 m-5,-5 h10 v10 h-10">
<animateMotion path="M 0 0 v 30 Z" dur="0.8s" repeatCount="indefinite" />
</path>
<path stroke="white" fill="none" stroke-width="8" stroke-linecap="round" d="M200,230 l34,34 l34,-34 M200,230 l-34,34 l-34,-34">
<animateMotion path="M 0 0 v 30 Z" dur="0.8s" repeatCount="indefinite" />
</path>
</svg>
......@@ -55,7 +55,7 @@ func loadProgramFileMeta(cfg *config.Config, filename string, src interface{}) (
vfs = new(config.PkgVFS)
if vfs.App == nil {
vfs.App = fstest.MapFS{
"app.wa": &fstest.MapFile{
filename: &fstest.MapFile{
Data: srcData,
},
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册