Files
marqdo/doc/design/code-vs-comment.md
T
cflmyandCursor bfb10d172b feat(markup): adopt v0.3 as sole mapping (** code, * return)
Make prose-unified Markup the only runtime: bold segments are executable,
italic is return, params can be inferred from body/prose, with no v0.2 dual
mode. Migrate lib and structure/keywords golds; gate on tests/markup-v03.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 20:38:53 +08:00

54 lines
1.8 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.
# 可执行面与叙述面
| | |
|---|---|
| 状态 | 与 mapping **v0.2** 对齐(成段注释);**v0.3 草案**见 [markdown-mapping-v0.3.md](markdown-mapping-v0.3.md) §4 |
| 日期 | 2026-08-04 |
| 修订 | 2026-09-13:注明 v0.3 叙述可含声明与行内代码段 |
---
## 三层
| 层 | 形态 | 角色 |
|----|------|------|
| **叙述面** | 成段注释(空行分段) | 注释;段内任意标记无语义 |
| **Marqdo 可执行面** | 结构标记 + `*语句*` + `**返回**` | 本语言程序 |
| **外联面** | ` ```lang ` | 其它语言(FFI) |
输出属于可执行面里的**函数调用**(`> print …`),见 [keywords.md](keywords.md)。
### 成段注释
- 以**空行**划分段落。
- 段首行:首字符非标记 → 注释。
- 段内续行:一律注释(即使以 `` ` `` / `-` / `**` 等开头)。
- **例外**:整行仅为 `**expr**`(或 `****`)→ Marqdo **返回**;`**强调**` 后还有文字 → 仍是叙述注释。
- 叙述段与可执行代码之间**必须空一行**,否则 `> print` 等会被吞进注释段。
---
## 语句 vs 返回 vs 输出
| 标记/形式 | 角色 | 是否架构级 |
|-----------|------|------------|
| `*…*` | 程序语句 | 是 |
| `**…**` | 返回值 | 是 |
| `****` / 空粗体 | 空返回 + 结束函数体 | 是 |
| `> print …` | 打印副作用 | 否(内置函数) |
| 函数体 `---` / `***` | 结束函数体 | 是(边界) |
---
## v0.3 草案预告(未实现)
[mapping v0.3](markdown-mapping-v0.3.md) 拟改为:
| 层 | 形态 |
|----|------|
| 叙述面 | 普通段落;`` `名` `` 可声明/引用 |
| 可执行面 | 结构标记 + **`**代码**`** + **`*返回*`**;调用可无 `>` |
| 外联面 | 不变 |
现行实现与上表(v0.2)一致,直至路线图默认切换。