Files
Interpreter/Doc/compiler/编译管线.md
T

27 lines
1.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.
# 编译管线
compiler 模块:ST / toml 编译器。CMake 目标:`compiler``STATIC`),依赖 [`指令与映像.md`](../isa/指令与映像.md)。
读齐工程后走直通 pass,产出单一映像,不上 LLVM。词法、语法、符号表、检查、codegen、链接都留在本库,不再拆 CMake 子库。
语言规则、toml 字段、链接与第 12 节阶段见 [`初步计划.md`](../初步计划.md)。指令和映像只认 [`指令与映像.md`](../isa/指令与映像.md)。
## 管线
```text
读 toml、收齐 .st
→ 词法 / 递归下降语法
→ 收集导出符号
→ 解析 VAR_EXTERNAL、链接、定地址
→ 类型检查
→ 按 PROGRAM / FUNCTION / FB 编寄存器码
→ 回填跳转、写映像头与工程哈希
```
## 边界
- toml **不声明变量**`VAR_GLOBAL` 第一版只允许出现在 `gvl.file`
- `[[io.*]]``var` 必须已在 GVL 中;同名全局链接失败
- 第三方 toml 解析放 `third_party/`,本库私有链接
- 不写扫描周期,不链 `vm`