programming-languageagentagent-firstcomparisondesign-patternarchitectureagent-designmcplsplcncodemapgraph-nativeeffect-system type: comparison 创建: 2026-06-18 更新: 2026-06-18

AI-First Programming Languages — 横向对比

2026-06 更新。聚焦两门已知公开的 AI-first 编程语言设计: entities/ling-lang(灵, v0.0.6, 27 ADRs, codemap-as-design-surface) 和 entities/zerolang(v0.3.4, graph-native, zero patch)。 同时纳入另外 4 个 PL/PL 设计做参照(Mojo、Carbon、APL/J/K 系、 JetBrains MPS),看 AI-first 是孤注一掷还是新趋势。

一句话定位

项目一句话定位状态
灵 (Ling)AI-first, 中英双语, codemap (LCN S-exp) 是 canonical IR, source 是 projection, MCP/LSP 是 AI 入口设计锁 (27 ADR), v0.0.6 实现中, Rust+LLVM 20
ZerolangAI-first, graph (zero.graph) 是 program database, .0 是 projection, zero patch 是 AI 入口实验性 v0.3.4, C-impl compiler, vercel-labs
MojoAI-first Python 兼容超集, 强调 ownership + 异构加速 (CPU/GPU/AI 加速器)早期 (Modular 公司), 不是严格的”AI 作者”而是”AI 友好”
CarbonC++ 继任者 (Google), 实验性, 强调 interop + 性能, 不强调 AI-first实验性, 早期, 设计中
APL/J/K 系array-first + 极简原语, 长期被认为”可写性差,人类难,程序紧凑” — 反而对 AI 友好?成熟但小众
JetBrains MPSprojectional editing, 文本是 projection, AST 是 source of truth成熟商业, 不是 AI-first 但结构化相同

重点对比的两门:

  • Ling 是用户的项目(27 ADRs 锁设计,27 ADRs 不可变)
  • Zerolang 是外部项目(v0.3.4, 较成熟但仍未 v1.0)

核心范式对比

维度Ling (灵)ZerolangMojoCarbonAPL/J 系JetBrains MPS
核心论断AI first, human second; codemap 是 canonical IRAI first; graph 是 program database; text 是 projectionAI/ML 加速, Python 友好C++ 继任, 性能 + interoparray-first, 极简projectional editing, 文本是 AST 投影
Canonical 状态codemap (LCN, S-exp)zero.graph (binary graph)text (.py/.mojo)text (.carbon)textAST (projectional)
Source 关系projection of codemap (双向同步)projection of graph (zero export)source of truthsource of truthsource of truthprojection of AST
AI 编辑入口MCP/LSP tools (ling_query_*)zero patch (typed ops)n/a (传统文本编辑)n/an/aprojectional editor
AI 读源通过 MCP tool, 不读 .lcn 直接 I/Ozero query 然后可能读 .0直接读 .py直接读 .carbon直接读直接读 AST (projectional)
目标用户AI 主, human 审AI 主, human 审人类 ML 工程师 (AI 加速)系统程序员数值/金融工程师DSL 作者
Bilingual / 国际化中英双语关键字 (KwLet = 让 = let)英语英语英语英语 (Unicode-aware)n/a

Canonical IR 形态对比

维度Ling codemap (LCN)Zerolang zero.graphMojo ASTCarbon AST
形态文档 (S-exp)图 (binary)树 (text)树 (text)
持久化.ling/codemap/*.lcn, gitignoredzero.graph, 仓库内 (graph-first package)n/an/a
Hash 策略daemon-owned, regenerablecontent-hash (per ADR 0027-aware, content-hash decides drift)n/an/a
Schema 强制度强: structured 字段 + narrative 字段强: shape-validated graph中: 类型系统中: 类型系统
Narrative 字段一等公民 (意图, 示例, 设计笔记 — CommonMark)无 (Zerolang 没有意图字段等价物)无 (注释)无 (注释)
可读性 (人类)中 (S-exp 但要学)低 (binary)高 (Python-like)高 (C++-like)
可读性 (AI 工具)低 (MCP-tool 抽象后, AI 不直接读)中 (zero query 输出文本)高高
修订单向性双向 (code ↔ codemap 都是一等)单向 (text 是 projection, 正常通过 zero patch 写 graph)单向 (text → 一切)单向

核心差异:

  • Ling 把”design rationale”做成了 codemap 的一等字段 (意图, 设计笔记)。AI 看 structured, human 看 narrative。
  • Zerolang 把所有 metadata 都做成 graph node, 没有”narrative”的等价物。
  • 传统 PL 把所有 design rationale 放在注释里, 不是 schema-enforced。

Edit Primitive 对比

维度LingZerolangMojoCarbon
AI 编辑主路径ling patch → 通过 ling_query_* + source → codemap 提取zero patch --op '<op>' 直接改 graph直接改 .py 文本直接改 .carbon 文本
Edit preconditionreverse-check 效应 (函数层)graph hash + node hash + field expecttype-check 提交type-check 提交
Edit guardrail”pure-first, IO must tag” (效果在 signature 层可见)--expect-graph-hash, --expect (field-level lock)无 AI 专用无 AI 专用
Bidirectional是 (codemap → code 也是一等)否 (text → graph 正常, 反向通过 zero import)否否
Error 信息形式LCN field (codemap 字段) + diagnostic codesnode IDs + graph hashes (machine-readable)Python tracebackC++ diagnostic
AI 读 diffling review (codemap diff + 设计解释, ADR 0010)zero diff (graph diff)git diffgit diff

类型 + 安全模型对比

维度LingZerolangMojoCarbon
类型系统hybrid (explicit preferred, local inference)static, with raises [Invalid] fallible functionsstatic, Python-likestatic, C++-like
内存模型region inference β, no GC, ownership-basedexplicit capabilities (world: World), no ambientownership (Rust-like)ownership (C++-like)
效应 / 副作用显式 effect tags (!FS/!Net/!Clock/!Rand/!Panic), pure-first + reverse-checkexplicit capabilities passed as args (no ambient)无内置效应无内置效应
Effect 来源signature 层 (reviewer 一眼可见)capability 参数传递 (reviewer 看 main 签名)无无
Effect 实现成本~1 周 (finite reverse-check)隐式 (无, 用 capability 替代)n/an/a
Generics推迟到 v0.1+ (codemap 暴露 call sites, monomorphic 足够)已支持, generic types已支持已支持
编译期事实compileTime, target.pointerWidth, fieldType, hasEnumCase同 (MET001 诊断)comptime 强大constexpr

Performance Budget (AI 视角)

Ling 给了详细的 AI-场景性能预算 (ADR 0022)。Zerolang 没明说,但有 zero size --json, zero mem --json, benchmark docs。

OperationLing v0.0.x floorLing v0.1+ targetZerolang 类似
增量编译 (改一行)200ms100ms没说, 但有 --json size/mem
Canonical IR 查询20ms10mszero query <100ms (估计)
LSP/MCP round-trip40ms20msn/a (没有 MCP 集成)
Daemon 启动1s500msn/a (no daemon)
冷编译 (10k LOC)20s10s没说
Memory (10k LOC)200MB100MBbinary store, 估计 50-100MB

关键观察: Ling 把 daemon + MCP round-trip 当作 AI 路径的关键路径指标,Zerolang 不假定 daemon,直接走 zero patch 命令。

Daemon / Background Process 对比

维度LingZerolang
Daemon?是 (ling daemon, ADR 0024 hybrid)否 (无 daemon)
FallbackFile-level 读 .ling/codemap/*.lcn (CI/无 daemon 环境)无, 每次 zero query/patch 都直接走 graph store
优点长 session 快 (codemap 在内存, daemon-owned)简单, 无 IPC, 无 daemon 维护成本
缺点多了一个进程要保活, 增加 crash surface每次 query 重新解析, 长 session 慢
AI 集成点daemon host MCP server (per ADR 0024, 0027)zero patch 命令, 通过 tool wrapper 暴露给 AI

AI 工具集成

维度LingZerolang
MCP 集成核心 (ADR 0027: “AI 通过 MCP/LSP, 不直接读 .lcn”)没说, 有 zero skills bundled skills
LSP 集成核心 (LSP server wraps codemap queries)没说
Version-matched skillsn/a (compiler daemon is the canonical source)是 (zero skills get <topic>, 9 个 bundled skills, ~70 KB)
Skill 安装ling-install-agent (daemon + MCP 自动注册)npx skills add vercel-labs/zerolang (bootstrap stub)
AI tool 抽象层单一 CodemapBackend trait, DaemonBackend + FileBackend 双实现zero query / view / patch / inspect 各自独立命令

何时选哪个?

场景推荐原因
AI 是主要作者, human 偶尔审Ling 或 Zerolang都明确为 AI-first 设计
需要 design rationale 持久化 (intent, why)Lingnarrative fields 一等公民, 不是注释
需要 strict structural edit guarantees (graph + patch + hash)Zerolang--expect-graph-hash, --expect field locks
需要 MCP/LSP 开箱即用LingADR 0027 把 MCP/LSP 作为 AI 主入口, 优先实现
需要 Chinese 关键字 / 中英双语Ling唯一已知的双语 PL
需要 region inference / no GCLing明确 v0.0.5 实现 region inference β
想要 graph 形式 IR (而不是 document)Zerolanggraph-first 是其显式承诺
想要简单的、命令式的 agent 编辑 surfaceZerolang9 个 zero * 命令, 不需要 daemon
想要 Python 兼容 + AI 加速Mojo不是 AI-first, 但 Python 生态
想要 C++ 继任Carbon不是 AI-first, 但 Google 背书

哲学 / 设计哲学差异

维度LingZerolang
AI / human 关系”Let AI write a language that AI finds ergonomic” (ADR 0002)“Zerolang exists because humans increasingly ask agents to write programs” (README)
作者本人中文母语, ADR 大量中文, 中英对照英文
设计严肃性27 个 immutable ADR, 9 个 L1-L4 层, 6-rein harness4 个核心 doc (graph-architecture, projections, semantic-vs-text, compile-path) + bundled skills
后端自研 MIR + LLVM 20 + Cranelift + wasm (planned)C-impl compiler, 8 个 native target
目标v1.0 = “production-ready” 长期v0.x experimental, 接受 breaking changes
AI 工具设计daemon + MCP, 多 tool, daemon 是 hostcommand-line, agent calls zero patch 一次, 不需要常驻
安全性effect reverse-check (pure-first)capabilities (no ambient global access)
Reviewer 视角签名层可见 effectsignature 层可见 capability 参数

共同的设计哲学 (与主流 PL 对比)

两门 AI-first PL 都有这些与主流不同的核心点:

  1. Canonical IR ≠ text — 都是”text is a projection”。Zerolang 用 binary graph, Ling 用 LCN document, 但都不是”text 是一等公民”。
  2. AI edit 走显式路径 — Zerolang zero patch, Ling MCP tool。不假定 AI 直接改文本。
  3. Drift 是显式管理的 — Zerolang 用 content-hash 决定 RGP006, Ling 用 daemon-owned codemap 强制 schema 一致。
  4. 安全 = reviewer-visible — Zerolang capabilities, Ling effects, 都是为了让 human reviewer 在签名层就能看到函数能不能 IO。
  5. Schema 强约束 — Zerolang shape-validated graph, Ling structured+narrative fields with enforced schema。
  6. Pre-1.0 experimental — 都明确说”pre-1.0, expect breaking changes, use in isolated workspaces”。

不确定的 / 待观察

  • MCP 集成的成熟度: Ling 把它作为 critical path, 但 v0.0.6 还没到 LSP/MCP 阶段 (按 roadmap 是 v0.1.0+)。Zerolang 没有 MCP 集成, 但有 zero skills bundled skills 作为 agent knowledge 来源。两种模式哪个更 work, 需要 2026-2027 看实际使用。
  • Codemap 双向同步的实际可行性: Ling ADR 0025 说 statement+function 粒度 sync, 但双向同步的 conflict resolution 在真实使用中可能比预期复杂。
  • Graph vs Document IR 的胜出: 长期看, agent 是否会偏好 graph (structural queries) 还是 document (narrative queries)? 取决于什么样的 query 最常见。如果 “what does this function mean” 重要, Ling 赢; 如果 “what calls this” 重要, Zerolang 赢。
  • Effect system vs Capabilities 的胜负: 两个不同的安全模型, 都在为同一目标 (reviewer-visible side effects) 服务。哪个更 AI-friendly, 需要 2027+ 观察。

关键 takeaway

  • AI-first PL 设计已经分化为两派:graph-based (Zerolang) vs document-based (Ling)。
  • 两种都拒绝”text is source of truth”, 都在 explicit 编辑路径, 都有 reviewer-visible 安全机制。
  • Ling 的独特优势: design rationale (narrative fields), 中英双语, MCP/LSP 集成是 critical path。
  • Zerolang 的独特优势: graph-based structural guarantees, hash-based drift detection, content-hash 的”哪个 side moved”判断。
  • 两者都不是给”AI 加速”用的 (像 Mojo); 都是”为 AI 作者/读者”重新设计的 PL。

相关页面