Repository navigation
docs(规格): v4 布局规格(T0)——五条判定 + 六条判据(四条零构建)+ tools/v4_layout_probe.py 零构建探针 - #173
Merged
Merged
Conversation
…ayout_probe.py 零构建探针(4 子命令·正反两态实测)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这是什么
v4 语法迁移的 T0 产物:布局规格 + 它的零构建探针。计划 §三 规定「T0 的产物是一份规格文本,不是实现」——这是那份规格,外加它要求新建的判据载体。
docs/maintainer/design/v4-layout-spec.mdtools/v4_layout_probe.pyconcat-layout/semi-resolvers/struct-lit-forms/tokenize-sites/colon-positions零既有文件改动(
jj diff --stat= 2 files, +1930, −0)。五条判定
:⇒T_COLON_BLOCK,行内:⇒T_COLON_DECL,两集合互斥且穷尽 ⇒ parser 零前瞻。行内/行尾的精确措辞 = 「:之后到该物理行行尾不存在任何 token」catch绑同层内最邻近其前的那一条可失败语句/声明(绑整条);回填时序钉死为语句边界判定 → 回填 → region 收尾 → 解糖 → 常量折叠;给 C1–C5,计划的反例绑loopType { field = value };分隔符必须在 parser 里校验为=(今天parser.cr:552-554盲跳 ⇒ 两形都收);未选形的:须 rc=1 + 新码EC_P_STRUCT_LIT_SEP = 1030(P030)tokenize取 (b) 显式旁路旗标g_layout_bypass(0 = 发射 = 默认 fail-closed);理由含「同文件已有g_parse_no_struct_literal先例」判据完备性(计划 §3.6 验收第 2 条)
零构建可判 ✅:J-T0-1 · J-T0-2 · J-T0-2b · J-T0-4(反向) · J-T0-5(静态半)。
需构建才能定论:J-T0-3 · J-T0-4(正向) · J-T0-5 的「深度相等」半。
裁定 ② 的两条连带后果(已写成唯一措辞)
:必须行内有后继 token;行尾:一律是 region 开启;行尾标注不是合法文本 ⇒ 响亮拒绝,不得静默改判。反例扫描:零反例。 v3 语料 227 档行尾
:= 0;v4 原档 77 个 core 代码块的行尾:= 57 处,逐处都是 region 开启(fn/struct/enum/impl/match/catch/lambda/spec fn)。⇒ 条款无需例外表。:之后跳过空白与注释,再无 token ⇒ 行尾。与 ① 同源无冲突(都出自「注释不是 token」)。并点明两处交互:跨行块注释那一格用「不存在任何 token」定死;① 的 anchor 计算与 ② 的行尾判定必须共用同一个注释/字符串感知扫描器。我(team-lead)的独立复跑
--sep-col 4⇒ rc=0 不红(那行仍是「只含注释的行」⇒ 按①-2 是 no-op)⇒ 作者保留该格改作正控是对的 ✓fn f(a:✓:= 0)examples/*/*.s(汇编标签),限定*.cr后 = 0 ✓src/compiler真字面量花括号 = 仅elf.cr:45parser.cr:1201是注释里的 struct 模式示例)作者自己抓到的两处(都已就地改正)
:,会漏掉续行上的头部终结(b: int):)。已改成跨行头部状态机,fn f(a:这一格才被判出来 —— 这正是「判据把缺陷固化成预期」那一类的自我纠正。两点澄清(防止被读成新增实现负担)
fn f(a:断行形态:lexer 层无法与fn f() -> int:的头部终结区分(都发T_COLON_BLOCK)。正确处置是 parser 在形参位期望T_COLON_DECL却拿到T_COLON_BLOCK⇒ 亮错,不是让 lexer 变聪明。「括号配平」只是探针的离线判定方法,不是给实现的约束。:= 0 ⇒0 == 0。今天承载鉴别力的是 A1 夹具表(19 夹具 / 28 个:)与两族反向。未核实
10 条(§8 T0-U-1…T0-U-10),全部因为零构建:任何构建结果 · 模型与 T5 lexer 逐位一致 · 多行表达式上的行边界行为 · 两套前端分歧是否可观测 ·
1030号段是否与并行批次冲突 · §2.2 逐形表在真实 v4 语料上的完备性(须 T4 后重跑)· §2.3「共用扫描器」约束在 T5 是否真做到 等。;消解器清单 35/35 全覆盖(MISSING=0 / stale=0);tests/harness/test_todo_id_migration.py6/6 通过;全程零构建。