Skip to content
lom-langPublic

About

Lom (Language of Machine) — A programming language designed for the LLM repair loop — structured diagnostics, mechanical lom fix, self-hosting strong quine, zero-dependency Rust core.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Lom

Lom (Language of Machine) — an AI-native programming language designed around the LLM repair loop: when a model writes broken Lom, the language itself is built to diagnose it precisely and fix it mechanically.

LLM-coding-native first, workloads later. Built in Rust.

CI deps unsafe license

Why Lom exists

Most languages treat "an AI wrote broken code" as someone else's problem. Lom inverts that: repair is the language's reason for existing. Every rejection carries a structured diagnostic code and, where a mechanical fix is safe, lom fix applies it for you — the same interface an LLM agent uses. The whole toolchain (diagnostics → lom fix plans → applied patches) is machine-readable by design.

The evidence

Claim Receipt
The repair loop works on real models On the then-full 128-task set (10 categories; the suite has since grown to 129 via task 130), deepseek-v4-pro+thinking and glm-5.3 score 98.3% / 98.5% pass@1 (2 models × 10 samples @ t=1.0; pass@5 99.2% / 98.8%) — the only sub-100 tasks are a known prompt-ambiguity anchor and one deliberately hard cross-compiler repair — report
The compiler compiles itself — provably self_comp.lom (12,671 lines of Lom) compiles its own source to WASM; the result is byte-identical from both sides (a 272,925-byte strong quine, re-verified on every CI run)
A trustable core Zero third-party crates, zero unsafe, 696 unit + 131 integration tests, three-OS CI; the language surface (syntax / 20 keywords / diagnostic codes / 43 builtins) is frozen — changes require an RFC

Feel the repair loop in 60 seconds

hello.lom — you (or your model) forgot the import:

fn main() -> Unit
    println(len("hello"))
end

Run it, and the diagnostic tells you exactly what to do — then let the language do it:

$ lom hello.lom
[runtime] error (2:13): [RUNTIME002] 符号 'len' 未导入。需在文件顶部声明:from string import {len}

$ lom fix hello.lom --apply
lom apply: hello.lom(迭代 2 轮)
  round 1: applied 1, skipped 0
    [1:1] insert (NAM005) — 在文件顶部插入 'from string import {len}'
  最终诊断(修复后源码): 0 错误 / 0 警告

$ lom hello.lom
5

That insert is a high-confidence mechanical action; ambiguous cases surface as hints instead of silent rewrites. The same lom fix plan format (lom-fix/v1) is what LLM agents consume — see SPEC_FOR_AI.md.

Quick start

cargo build --release            # builds target/release/lom (zero dependencies)
./target/release/lom examples/fib.lom    # run a program

A minimal Lom program (fn + tail-expression return; blocks close with end):

fn main() -> Unit
    println("hello, lom")
end

Save as hello.lom, run lom hello.lom. When a run fails at run time, lom hello.lom --trace prints a call-level JSONL event stream to stderr (--trace-out <file> to redirect, --trace-max-events <n> to cap, --trace-builtins to include builtin calls) — see SPEC_FOR_AI.md §11g; AOT lom build artifacts never pass through the interpreter, so --trace does not apply to them. Since v1.17.0 a run-time error reports the line and column of the failing expression, and lom fix hello.lom --plan --run lets the fixer observe a run-time failure first-hand — it executes the program once under a time budget (stdout discarded, opt-in, side-effect-gated) and adds what it sees to the plan — see SPEC_FOR_AI.md §11e; the same AOT caveat applies: lom build artifacts fail without a position. New here? Read SPEC_FOR_AI.md (the LLM-facing language spec). AI maintainers start with the copy-ready handoff prompt, the maintenance protocol, then docs/HANDOVER.md — internal governance and working history, maintained in Chinese (see docs/README.md for the map of English vs Chinese surfaces). 中文读者:README.zh-CN.md。

What is Lom

Lom is a progressively fused AI-native programming language:

  1. Phase 0-3 — LLM-coding-native: tolerant parser, structured JSON diagnostics, linear pipeline syntax, structural types, gradual typing, explicit effect system. Target: LLMs write Lom with low error rate and easy recovery. (Done — original 99/100 single-model baseline 2026-08-03 REPORT.md; multi-model validation followed 2026-08-31: 99.1-100% across 4 models on the full 113-task set multimodel report; single-run sampling closed by the 2026-09-07 pass@k retest — 2 models × 10 samples @ temperature=1.0, pass@1/5/10 = 99.1% each (pass@k report); the cross-language control group remains open, stated as such)
  2. Phase 4 — LLM-repair-native + toolchain (direction adjusted 2026-08-07): expand lom fix in-place auto-repair (differentiation — MoonBit doesn't do in-place repair), add REPL / LSP / package manager. Original "workload-native" (tensor/autodiff/MLIR) dropped — Mojo (acquired by Qualcomm) saturates the AI-compute lane.
  3. Phase 5-7 — ecosystem & backends (done 2026-08): bootstrap self-hosting feasibility (a 1450-line mini-interpreter written in Lom), production engineering (semver, 3-platform CI, lom doc/fmt), and a hand-written zero-dependency WASM compiler backend (lom build --target wasm) with byte-identical dual-backend output. Since 2026-08-25: fix-engine deepening (M1-M4 — spelling-repair replace actions, iterative --apply loop, targeted PARSE001 fixes, expanded error_repair eval).

Why Lom

The "AI-native language" space (2026-08 retrospective):

Direction Leaders Status
Workload-native (tensor / autodiff / GPU) Mojo (acquired by Qualcomm $3.9B), Bend Saturated. Mojo binds to Qualcomm hardware strategy. Not Lom's lane.
LLM-coding-native (write-it-right) MoonBit (IEEE TSE 2026 paper: 1/7 corpus but 2x AI gen rate vs Gleam; ~400k users; 1.0 imminent Sep 2026) MoonBit leads. Lom's 99% eval validates the same thesis.
LLM-repair-native (fix-it-fast) — Lom's lane Lom (lom fix --apply iterative in-place repair, tolerant parse, gradual typing) Empty. MoonBit regenerates on error; Lom patches in-place. Complementary, not competitive.

Lom takes the differentiated route: occupy the empty LLM-repair-native lane — in-place auto-repair (lom fix --apply), tolerant parsing, confidence-graded fixes — complementary to MoonBit's write-it-right approach.

Design Philosophy

  1. Locality > Globality — declarations and usage must close within the same view.
  2. Tolerance > Strictness — syntax errors non-fatal, type errors degradable.
  3. Linear > Nested — pipeline, early return, guard clauses over deep nesting.
  4. Self-describing > Implicit convention — intent in code (executable docstrings, schema-as-type).

Status & boundaries (honest version)

  • Current: v1.18.0 (2026-11-25). Language surface frozen since v1.0 (2026-09-02): syntax / 20 reserved words / diagnostic codes / 43 builtins have not changed since, and every release has been tooling/evidence work (process exit codes from fn main() -> Int — the one semantics addition, made through RFC-0005; runtime-error positions and lom fix --run, the agent execution trace --trace, online playground incl. the in-browser self-hosting demo and share links, ACRI native conformance with lom explain, the iterative-repair benchmark category, structured diagnostics, remediation). Full numbers: see Benchmark and live numbers below; the per-release log: CHANGELOG.md; the Phase 1–8 feature checklist: docs/milestone-history.md.
  • The L2 self-hosted subset compiler (examples/selfhost/self_comp.lom) is a supported face as of v1.8.0 (2026-10-08; promoted from experimental by user adjudication after four consecutive A- review rounds, a zero-open ledger, and the v1.7.2 line-number batch completing its repair loop): it compiles a strict subset of Lom to WASM, rejects some programs the host accepts (each rejection carries an [L2xxx] code and a repair hint via lom l2fix / tools/l2fix.py; rejections whose message carries a quoted name also carry a ln:cl source position — the registered 71/102 coverage boundary with 31 exempt type-string cases), and self-hosts provably.
  • The 38 review rounds are in-system adversarial reviews (agent-run, evidence-based) — good hygiene, not external peer review; grades never extrapolate across baselines.
  • Online playground — run Lom, see structured diagnostics, and apply lom fix --apply with a line diff, entirely in your browser (the full host toolchain compiled to wasm32-wasip1, zero third-party JS). Pressing Run quietly folds your program into the URL hash (UTF-8-safe), so opening the shared link restores your exact editor content.
  • Honest note on the exit criterion: "a third-party project deployed to production with Lom" cannot be self-certified — the engineering surface is done; adoption remains the long-term north star

Benchmark and live numbers

RepairLoopBench — the 138-task repair-suite benchmark (eval/README.md is its benchmark card): a contamination-safe, dual-backend benchmark for the repair loop — its error_repair tasks hand models real structured diagnostics (verbatim host --check --json plus the L2 cross-compiler's [L2xxx] channel) and score convergence through the advisory fix loop; a scope statement distinguishing it from SWE-bench-family suites is on the card. Headline: full-set pass@1 = 98.3% / 98.5% across two frontier models (10 samples each, unbiased estimator, 2026-10-07 — full-set report). For citations, see the Citing section of the benchmark card (cite the tag, not main).

Verify the claims (from a fresh clone; ~5 minutes — the full third-party reproduction guide, including the LLM pass-rate experiments and what a fresh clone can and cannot verify, is docs/REPRODUCING.md):

cargo build --release && cargo test --release     # 696 unit + 131 integration tests
python tools/verify_selfcomp.py                   # L2 self-compilation: 368/368
python tools/verify_selfcomp.py --bootstrap       # three-layer bootstrap 14/14; the self-hosted
                                                   # compiler regenerates a byte-identical 272,925-byte quine
powershell -ExecutionPolicy Bypass -File eval/runner/run.ps1 -Verify -LomBin ./target/release/lom.exe   # eval 138/138
./target/release/lom.exe codes --json | python -c "import json,sys; print(json.load(sys.stdin)['total'])"  # 47

696/696 Rust unit tests pass (plus 131 process-level integration tests: CLI exit codes, LSP stdio e2e incl. the R63 transport-boundary pair and the R71/R72 transport-corner trio, the R94 in-package-alias pair, the R104 same-name-package determinism ×6 in tests/r104_dedup_order.rs, and the R108 variant-externals ×5 in tests/r108_variant_externals.rs, and the R107 alias-clash ×4 in tests/r107_alias_clash.rs, and the closure-externals ×3 in tests/build_closure_externals.rs, and the runtime-error-position ×6 + fix --run ×12 pair in tests/d0028_runtime_position.rs / tests/d0028_fix_run.rs, and the type-checker batch ×23 in tests/d0029y_type_position.rs ×8 / tests/d0029y_tail_return.rs ×4 / tests/d0029y_nam007.rs ×7 / tests/d0029y_generic_enum.rs ×4, and the tool-chain batch ×36 in tests/d0029x_build_exit_codes.rs ×11 / tests/d0029x_r237_diag_once.rs ×4 / tests/d0029x_r242_dep_runtime_source.rs ×4 / tests/d0029x_manifest_diag.rs ×5 / tests/d0029x_fix_externals.rs ×4 / tests/d0029x_dep_notice.rs ×3 / tests/d0029x_no_main.rs ×5, and the process-exit-code batch ×14 in tests/d0032_exit_code.rs ×11 / tests/d0028_fix_run.rs ×3 more). 38 .lom files (29 examples + 4 bootstrap self-hosting files + 2 in the pkg_demo package + 3 self-hosted sources in examples/selfhost/ — the 5727-line reference interpreter self_interp.lom, the L2.1 encoder spike l2_spike.lom, and the 12671-line L2.3 subset compiler (v1.7.2; tagged v1.6.0 source was 12572 lines) self_comp.lom; apply_test.lom is an intentionally-broken lom fix demo). eval/ 138/138 reference solutions pass on both backends (tree-walking interpreter and WASM; ./eval/runner/run.ps1 -Verify -LomBin target/release/lom.exe, -Backend wasm for the WASM side). LLM generation pass-rate: 99.1-100% across 4 models (deepseek-v4-pro+thinking / v4-flash / glm-4.7 / glm-5.3, 2026-08-31, full 113-task set as it stood then — multimodel report); original 99/100 baseline: 2026-08-03, 100-task set (REPORT.md). pass@k retest (2026-09-07): 2 models × 10 samples @ temperature=1.0 on the 116-task set — pass@1 = pass@5 = pass@10 = 99.1% for both deepseek-v4-pro+thinking and glm-5.3 (unbiased estimator; only task 078, the prompt-ambiguity anchor, fails systematically — 0/10 both models) — pass@k report. full-set pass@k (2026-10-07, the current headline evidence): the same 2 models × 10 samples @ temperature=1.0 on the full 128-task set (first multi-sample measurement for the v1.5.0-era additions; tasks 126/127 tightened the same day per the ambiguity-fix lineage 078→118→126) — pass@1 = 98.3% (deepseek-v4-pro+thinking) / 98.5% (glm-5.3), pass@5 = 99.2% / 98.8%, pass@10 = 100.0% / 99.2%; sub-100 tasks fully attributed: 078 (known prompt-ambiguity anchor, its explicit twin 118 passes 10/10 both models) and 127 (deliberately hard L2-cross-compiler repair where 18/20 candidates miss one Option-unwrapping step) — full-set report. error_repair hot-patch sampling (2026-09-16): the same 2 models × 10 samples @ temperature=1.0 on all 24 error_repair tasks (including the four warning-level repair tasks 119/120/122 and LEX005 task 121) — 24/24 tasks × both models = 24/24 each, zero failures — patch report. iterative-repair first sampling (2026-10-28, the new category's debut): both models × 10 samples, single-step feedback chain, R=5 — C(2) = 100% for both (glm-5.3 C(1) 83.3% → C(2) 100%; deepseek-v4-pro+thinking 91.1% → 100%; zero censored at R=5); the headline hypothesis confirmed on task 131 (the known-hard 127 copy): single-round 30% on both models, and all 14 first-round failures converge in round 2 once fed the real diagnostics (14/14) — against the historical no-feedback baseline where 18/20 candidates miss the same Option-unwrap step: the repair loop's closure value, quantified — first iterative report. The latest committed main milestone is v1.18.0 (the process exit-code batch — fn main() -> Int returns the process exit code, shipped together with the type-checker and tool-chain patch batches; 61 new unit tests, 73 new integration tests), preceded by v1.17.0 (the runtime-error positions + lom fix --run batch — run-time diagnostics point at the failing expression, and lom fix --run observes a run-time failure under a time budget; 35 new unit tests, 18 new integration tests), preceded by v1.16.0 (the iterative-repair task category — 9 new tasks measuring how many rounds a fix takes; task count 129 to 138), preceded by v1.15.0 (the ACRI native-conformance + lom explain batch — a nested position object in the check envelope and per-code long-form documentation; 7 new unit tests), preceded by v1.14.0 (the agent execution-trace batch — --trace call-level JSONL events for the interpreter run mode; 12 new unit tests), preceded by v1.13.0 (the playground share-links batch — Run folds the program into the URL hash and shared links restore the editor; suite 129 tasks), preceded by v1.12.1 (the wasm file-builtins fix — the playground engine's file_exists/file_append defects repaired at the WASI-harness layer per designs/0025; suite 129 tasks), preceded by v1.12.0 (the playground self-hosting demo — an in-browser four-step chain producing the 272925-byte quine byte-identically; tag 4a64471), preceded by v1.11.0 (the RepairLoopBench runtime-diagnostic task 130 + the v1.10.3 claims precision-correction; tag e83177b). The twentieth in-system adversarial review (2026-09-30, covering the v1.4.2→v1.4.7 six-batch increment) rated the repository A- (zero claim distortion, 22 probes zero silent miscompiles); the twenty-first review (same day, covering the v1.4.8/v1.4.9 R94-closure batches) verified both batches' claims loss-free with the new behavior surfaces probe-clean, and opened R104/R105 (P1: interpreter cross-run nondeterminism on same-name package symbols, and opposite shadowing direction for alias-vs-user-fn — both pre-existing name-collision surfaces awaiting adjudication) plus R106 (P3 documentation staleness, fixed on the spot). The twenty-second review (same day, baseline 92502e2) confirmed the R104/R105 closure conditions loss-free and rated the repository B+ (rebound per trajectory), opening R107 (P1, pre-existing: two packages importing the same alias with different real names resolve differently across backends, silently) / R108 (P2, pre-existing: package enum variants falsely rejected by --check) / R109 (P3, introduced by v1.4.10: merged-unit NAM006 noise on plain single-package imports) for adjudication.

The Phase 1–8 milestone checklist (the full feature history, kept as written at the time): docs/milestone-history.md.

Release log

Status: v1.0 — language surface FROZEN (2026-09-02). Frozen: syntax / 20 reserved words / diagnostic codes / 43 builtins (spec §14). Changes require a new RFC. Current release: v1.18.0 (2026-11-25; a program can choose its exit code — fn main() -> Int returns the process exit code, per RFC-0005 and designs/0032; versioned minor because it adds semantics — the four frozen surfaces stay untouched: zero syntax / keyword / diagnostic-code / builtin change) — Until now a Lom program could only exit 0 or 1: whatever main returned was dropped, and there is no exit builtin — so a CLI tool written in Lom could not say "found problems" or "bad usage" without a wrapper script. From this release fn main() -> Int returns the process exit code: the tail expression or return n (0..255) becomes the code the process exits with. A main declared -> Unit (or left unannotated) still exits 0, whatever its last expression evaluates to; a run-time error still exits 1, and so does a code outside 0..255 or a non-integer return (a [RUNTIME000] diagnostic pointing at main's signature). lom build --target wasm artifacts behave the same through the shipped Node harness, and lom fix --run reports an observed code as "exit_code" next to "outcome": "pass". One habit changes: a successful program must end with 0 — leaving a computed result as the tail expression of an -> Int main now turns a correct program into a failing one (the spec says so in its core rules). Nothing existing is affected: none of the 555 tracked .lom files, the 138 reference solutions or the archived candidates declares -> Int, and the previous and new binaries agree byte-for-byte on every tracked file across five commands. This release also ships the patch-level fixes accumulated since v1.17.0 (listed in its CHANGELOG.md entry). Baseline unchanged: quine 272925, verify_selfcomp 368/368; tests 635+58 → 696+131.

Full release log — every version, as written at the time: CHANGELOG.md.

Roadmap (summary)

Phase Name Duration Exit criteria
0 Language Design & Spec 1-2 w LLM reads spec, generates valid code >80%
1 Minimal Interpreter 4-6 w 10+ test cases pass with LLM-generated code
2 LLM-coding-native Core 6-10 w LLM generation pass-rate eval set meets baseline
3 Usable MVP 8-12 w Write a complete CLI tool or simple web service — done (3.5 todo CLI)
4 LLM-repair-native + toolchain (adjusted 2026-08) — lom fix covers main diagnostic auto-repair + confidence model + REPL + LSP + package manager
5 Ecosystem & Bootstrapping done 2026-08-19 Bootstrap feasibility proven (mini-interpreter in Lom; full self-hosting = RFC-0003 draft, parked)
6 Production engineering done 2026-08-22 Semver, 3-platform CI, governance, lom doc/fmt, SECURITY.md
7 WASM compiler backend done 2026-08-23 (v0.15.0) lom build --target wasm; dual-backend byte-identical golden + eval 113/113×2(时点值,2026-08-23;现值见 eval/README)
8 Full self-hosting done 2026-09-02 (v0.23-v0.26) Frontend + static checks + evaluator in Lom (self_interp.lom); interpreter-carrier three-layer self-certification; wasm-carrier golden blocked by an unresolved OOB bug (RFC-0003 rev 21, post-1.0 ledger)
v1.0 Language-surface freeze 2026-09-02 (v1.0.0) Frozen: syntax / 20 reserved words / diagnostic codes / 43 builtins (spec §14). Post-1.0 ledger: wasm OOB deep-dive, L2 self-hosted compiler (blocker resolved), Pattern spans, package registry, debugger. Long-term north star: third-party production use — explicitly not a v1.0 gate

See the project guide for details.

Target LLM Priority

Priority LLM Phase Adaptation focus
P0 DeepSeek Phase 0 SPEC_FOR_AI readability, error JSON field response, error pattern sampling
P1 Claude / GPT Phase 2 Cross-model consistency baseline
P2 Kimi / GLM / Gemini Phase 3+ Coverage expansion

Tech Stack

  • Host language: Rust
  • Phase 1+: hand-written lexer / recursive-descent parser / tree-walking interpreter / WASM emitter — zero third-party dependencies (CI-enforced). The crate is a binary, not a library — a deliberate keep-it-readable decision.
  • Phase 4: reuse existing interpreter/typechecker/diagnostics — no new low-level deps (no Cranelift/MLIR). Adds lom fix rule expansion, REPL, LSP server, package manager.

License

Apache-2.0. See LICENSE.

Contact

About

Lom (Language of Machine) — A programming language designed for the LLM repair loop — structured diagnostics, mechanical lom fix, self-hosting strong quine, zero-dependency Rust core.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages