Files
Interpreter/compiler/README.md
T
AdminandCursor 2eb2468119 划定 CMake 模块目录并补充各层 README。
固定 isa/compiler/vm/host 的职责边界,样例与测试单独成目录。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 16:32:07 +08:00

29 lines
1007 B
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`),依赖 `isa`
读齐工程后走直通 pass,产出单一映像,不上 LLVM。词法、语法、符号表、检查、codegen、链接都留在本库,不再拆 CMake 子库。
## 管线
```text
读 toml、收齐 .st
→ 词法 / 递归下降语法
→ 收集导出符号
→ 解析 VAR_EXTERNAL、链接、定地址
→ 类型检查
→ 按 PROGRAM / FUNCTION / FB 编寄存器码
→ 回填跳转、写映像头与工程哈希
```
## 工程文件
toml **不声明变量**,只做三件事:列出源文件、指定唯一 GVL、(可选)把已声明的全局接到硬件。
- 字段:`files` / `entry` / `cycle_limit` / `dt_ms` / `gvl.file` / 可选 `io.*`
- 第一版只有 `gvl.file` 允许出现 `VAR_GLOBAL`
- `[[io.*]]``var` 必须已在 GVL 中声明,否则编译错误
- 同名 `VAR_GLOBAL` 链接失败,禁止覆盖
第三方 toml 解析放在 `third_party/`,本库私有链接。