Files
marqdo/README.md
T
cflmyandCursor a29bf6e97b Implement Phase I tree-walk interpreter for all examples.
Parse functions, calls, returns, branches, loops, tables, and imports so marqdo run passes the examples gold suite (M2–M4).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-04 11:41:37 +08:00

72 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Marqdo
**代码即文档。文档即代码。**
Marqdo:Markdown **标记即语法**。源文件 `.mq.md` 既是文稿也是程序。
语法宪法:[doc/design/markdown-mapping.md](doc/design/markdown-mapping.md) · 关键字:[keywords.md](doc/design/keywords.md) · 示例:[examples/](examples/)
---
## 语法速览(v0.1)
| 标记 | 含义 |
|------|------|
| 无标记行 | 注释 |
| `*…*` | 程序语句 |
| `**…**` | **返回值**(架构) |
| `> print …` 等 | 输出等副作用 = **普通函数**,非架构标记 |
| `#` / `##` | 函数与作用域 |
| `+` / `1.` | 分支(臂头单独 `*` = else) |
| `-` | 循环(头下纯名则为形参) |
| 表格 | 集合 |
| `---` / `***` | 可选:框住分支/循环(不强制) |
```markdown
# main
> print text=Hello World!
## 加一
- n
**`n` + 1**
```
---
## 理念
1. 叙述默认安全(无标记 = 注释)。
2. 返回是架构;打印只是函数。
3. 依赖清单由工具生成(OKF 风格),不是手填配置。
4. **正经解释器(Rust)**:词法/行分类 → 递归下降语法 → 语义 → 树遍历 → 日后字节码;**不用 Flex/Bison**。见 [路线图](doc/roadmap/interpreter.md) 与 [依赖说明](doc/design/dependencies.md)。
---
## 现状
- 映射 v0.1:[markdown-mapping.md](doc/design/markdown-mapping.md)
- 解释器路线图:[interpreter.md](doc/roadmap/interpreter.md)
- **Phase I(树遍历)已通**:`examples/` 下 hello / index / branch / loop / collection / with-import 均可 `marqdo run`
- 依赖(Rust,无 Flex/Bison):[dependencies.md](doc/design/dependencies.md)
- 选型:[ADR 0001 — Rust](doc/adr/0001-implementation-language.md)
```bash
cargo run -- run examples/index.mq.md
# Hello World!
```
下一步:按需加强语义诊断与表达式;Phase II 字节码见路线图 M5。
---
## 命名
**Marqdo** = Marq(Markdown)+ do(执行)
## 许可
[Apache License 2.0](LICENSE)