Stated 发布受控英语编译为 Go 代码工具

原标题:Show HN: Toy controlled English to Golang code
58AI 研判分

Stated 发布 v0.1 概念验证工具,可将受控英语文档确定性编译为可读的 Go 代码,编译过程不依赖任何大模型。其语法由受检文法与类型化词汇约束,每句只允许一种含义,否则直接报错。

关联知识实体

报道正文

本文目录4 个章节

Write controlled English. Compile deterministic code.

GET STARTEDProof of concept: v0.1DocumentationSource

◆ Controlled source

English-shaped syntax with programming-language rules. Every accepted phrase comes from checked grammar and typed vocabulary.

  • No arbitrary-English interpretation
  • No hidden behavior from familiar names
  • One meaning or a compiler error

◆ Deterministic output

The compiler resolves the whole document into explicit operations, bindings, branches, and data movement before emitting code.

  • Stable lowering from the same source
  • Checked integer arithmetic
  • Explicit ownership and traversal order

◆ Inspect the translation

The generated Go is an artifact you can read, review, diff, and compile with ordinary tooling. No model participates in compilation.

  • Source locations preserved
  • Definitions structurally inlined
  • Unsupported semantics are rejected

Stated · filter.ce

文本
The program accepts an integer sequence named input.
The program accepts an integer named threshold.
The program computes the following result.
Collect the input values in encounter order into a fresh sequence.
Retain each value only when it is greater than the threshold.
Replace each retained value with the doubled value of that value
before appending it.
GO
result := make([]int64, 0)
for _, value := range input {
    if value > threshold {
        doubled, ok := checkedAdd(value, value)
        if !ok {
            return nil, overflowDiagnostic()
        }
        result = append(result, doubled)
    }
}
return result, nil

Inspect the compilation yourself.

Start with one small Stated program, emit its Go source, and compare every authored operation with the generated code.

First programExamplesLanguage referenceStatus and limitations