Files
Admin 6873b5ee0b 文档同步:machine.toml 配置驱动架构收尾。
- README.md:依赖方向(STCompiler→compiler 不链 isa)、模块表、isa 归执行器侧、
  数据流图(machine.toml + 型号/SHA)
- isa/README.md:重写——只管指令定义(Types/Op/Instr/Encode),删 Image 部分
- 指令与映像.md:依赖图与 CMake(compiler 不链 isa)
- 编译管线.md:管线首步加载 machine.toml、产物含型号/SHA
- 初步计划.md:12.10/12.13 修订(--machine、依赖方向)
- 扫描周期.md / 指令执行.md:12.9 步骤标注已落地、vm 读校验说明
- compiler/vm/executor README:依赖与边界同步
2026-08-21 22:39:27 +08:00

29 lines
1.5 KiB
Markdown
Raw Permalink 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`),**不依赖 isa**(指令 opcode / 类型元数据 / FB 布局来自 `compiler/machine.toml`,见 [`指令配置.md`](../isa/指令配置.md))。可执行入口 `STCompiler`(本模块 `src/main.cpp`,链 `compiler`)。
读齐工程后走直通 pass,产出单一映像文件,不上 LLVM。词法、语法、符号表、检查、codegen、链接都留在本库,不再拆 CMake 子库。
语言规则、toml 字段、链接与第 12 节阶段见 [`初步计划.md`](../初步计划.md)。`.stb` 格式契约见 [`指令与映像.md`](../isa/指令与映像.md)compiler 自带写实现 + 型号标识/SHA-256)。
## 管线
```text
加载 machine.toml--machine,强校验)
→ 读 toml、收齐 .st
→ 词法 / 递归下降语法
→ 收集导出符号
→ 解析 VAR_EXTERNAL、链接、定地址
→ 类型检查
→ 按 PROGRAM / FUNCTION / FB 编寄存器码(opcode/类型/FB 布局查配置)
→ 回填跳转、写映像头与工程哈希
→ 写 <name>.stb(头 104 含型号标识 + 段 + SHA-256 文件尾)与 <name>.runtime.tomlsidecario 绑定)
```
## 边界
- toml **不声明变量**`VAR_GLOBAL` 第一版只允许出现在 `gvl.file`
- `[[io.*]]``var` 必须已在 GVL 中;同名全局链接失败
- 第三方 toml 解析(toml++)放 `third_party/`,本库私有链接
- 不写扫描周期,不链 `vm`、不链 `isa`