Skip to content

Commit 909621d

Browse files
committed
zz
1 parent 66a806f commit 909621d

16 files changed

+97
-37
lines changed

playground/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/book
2+
*.docx

playground/1.intro/readme.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

playground/Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
default:
2-
wabook serve
32

4-
build:
5-
-rm -rf ../book/playground
6-
mkdir -p ../book/playground
7-
wabook build && mv ./book ./en && mv ./playground ../book/
8-
-rm ../book/playground/.gitignore
3+
to-word:
4+
pandoc -f markdown -t docx README.md -o wa-play.docx
95

106
clean:
117
-rm -rf book

playground/README.md

Lines changed: 94 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,95 @@
1-
# 凹语言Playground
1+
![](cover.png)
2+
3+
---
4+
5+
## 1. 软件简介
6+
7+
凹语言 Playground 是一个基于浏览器的在线编程环境,用于编写、运行简单的凹语言程序。该系统旨在为开发者和学习者提供一个无需安装、即开即用的便捷平台,适合用于教学、测试和快速原型展示。
8+
9+
---
10+
11+
## 2. 使用方式说明
12+
13+
用户只需通过现代浏览器访问指定网址 [https://wa-lang.org/playground/](https://wa-lang.org/playground/) 即打开入凹语言 Playground 页面,无需下载和安装任何软件。支持桌面和移动端浏览器,推荐使用最新版 Chrome、Edge 或 Firefox 浏览器以获得最佳体验。
14+
15+
![](./images/2-overview.png)
16+
17+
---
18+
19+
## 3. 用户界面介绍
20+
21+
系统界面主要由以下几个部分组成:
22+
23+
![](./images/3-main-page-struct.png)
24+
25+
* **代码编辑区**:提供凹语言语法高亮功能,支持中文标识符、注释和中文示例代码。
26+
* **示例选择器**:内置多个预设示例,包括中文编程示例,可直接加载至编辑器。
27+
* **保存按钮**:点击后可立即保存并编译运行当前代码。
28+
* **Prewview输出区**:用于显示程序运行结果、编译日志或错误信息。
29+
* **WAT查看器**:查看编译生成的 WebAssembly 文本格式(WAT)。
30+
* **Memory查看器** 查看 WebAssembly 二进制格式(WASM)。
31+
32+
33+
34+
---
35+
36+
## 4. 编写与运行代码
37+
38+
用户可在编辑器中直接输入凹语言源代码,支持中文变量名和注释。点击“保存”按钮后,系统将保存代码并启动编译器,生成 WebAssembly 模块并立即执行,运行结果显示在输出区。
39+
40+
比如输入以下代码计算1到100的和:
41+
42+
```
43+
// 版权 @2019 凹语言 作者。保留所有权利。
44+
45+
func main {
46+
sum := 0
47+
for i := 1; i <= 100; i++ {
48+
sum += i
49+
}
50+
println("1+2+3+...+100 = ", sum)
51+
}
52+
```
53+
54+
执行效果如下:
55+
56+
![](./images/4-run-sum100.png)
57+
58+
Playground 还提供 WAT,展示编译后的 WebAssembly 文本表示形式:
59+
60+
![](./images/4-sum100-wat.png)
61+
62+
和查看 WASM 二进制格式的功能:
63+
64+
![](./images/4-sum100-memory.png)
65+
66+
程序在保存时运行前会自动进行格式化。
67+
68+
---
69+
70+
## 5. 示例程序演示
71+
72+
Playground 内置多个示例程序,可以通过示例切换程序选择:
73+
74+
![](./images/5-select-example.png)
75+
76+
涵盖hello、count、heart、brainfuck、closure、iface、map、defer、complex、iter和hello-zh等。
77+
78+
其中brainfuck例子展示了凹语言执行BF语言虚拟机的能力:
79+
80+
![](./images/5-example-bf.png)
81+
82+
hello-zh例子则展示中文编程的能力:
83+
84+
![](./images/5-example-zh.png)
85+
86+
87+
---
88+
89+
## 6. 常见问题与注意事项
90+
91+
* 推荐使用Chrome浏览器,老版本的浏览器可能存在部分兼容性限制。
92+
* 编译错误信息将在输出区显示,注意检查语法或变量定义是否正确。
93+
* 若运行无反应,请检查网络是否连接或刷新页面。
94+
295

3-
TODO

playground/SUMMARY.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

playground/book.ini

Lines changed: 0 additions & 11 deletions
This file was deleted.

playground/cover.png

26.3 KB
Loading

playground/images/2-overview.png

53.6 KB
Loading
66.2 KB
Loading

playground/images/4-run-sum100.png

42.4 KB
Loading

playground/images/4-sum100-memory.png

47.8 KB
Loading

playground/images/4-sum100-wat.png

84.6 KB
Loading

playground/images/5-example-bf.png

64.2 KB
Loading

playground/images/5-example-zh.png

39.6 KB
Loading
32.6 KB
Loading

playground/index.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)