56,000 行《毁灭战士》代码,用我自创的语言编写。
56,000 lines of DOOM, in a language I made up

原始链接: https://betlang.dev/about/

作者创造了“bet”,这是一种玩笑性质的编程语言。它采用了随意的群聊式语法,但确实具备完整的功能。出于在不受外部研究或市场趋势干扰的情况下完成项目的渴望,创作者专注于一个特定的技术挑战:实现一流的基于作用域的内存分配(arena allocation)以优化游戏性能。 该项目也是一次人工智能辅助开发的实验。作者仅充当架构师并设定严格的验收标准,成功引导人工智能编写了整个编译器,且全程未进行人工代码审查。为了证明该语言的稳定性和精确性,作者使用它移植了原版《毁灭战士》(DOOM)的全部源代码。最终生成的二进制文件在运行游戏时,与参考 C 语言版本帧帧一致、位位相同,展现了极高的技术精度。 在实现了创建功能性自托管语言并完成复杂的大规模移植目标后,作者认为实验已经结束。由于没有进一步开发的计划,“bet”作为一个已完成的概念验证项目,证明了即便是一个“玩笑”项目,只要管理清晰且持之以恒,也能达到专业级的水准。

最近 Hacker News 上的一篇题为“用我自创的语言写 56,000 行 DOOM”(betlang.dev)的帖子引发了深入探讨。该项目涉及一种自定义编程语言,但评论者对于在人工智能辅助下创建此类“玩笑”语言的意图和真实性展开了争论。 该讨论帖还突出了两个关键的争议点: 1. **人工智能的作用:** 用户认为,通过传统的编译器专业知识(如针对 LLVM)构建语言与通过人工智能生成语言之间存在显著的技术差异,并指出在人工智能使用方面的透明度对于可信度至关重要。 2. **文化敏感性:** 一位评论者对该语言的语法提出了担忧,认为常与边缘化互联网亚文化相关的“uwu”风格言语,可能会被视为对非裔美国人英语(AAVE)的一种冒犯性戏谑。其他用户则反驳称,这种风格是现代互联网用户中一种广泛存在的、与种族无关的趋势。 归根结底,这一提交案例展现了开发者和社区如何在人工智能辅助创作、技术价值与社会背景的交汇处进行博弈。
相关文章

原文

I built bet on a break from trying to make something that sells. I wanted a project with a clear edge to it, one I could actually finish, and building a compiler had been on my list for a long time. A joke language gave me the excuse: keywords that read like a group chat, wrapped around a compiler that had to genuinely work. I set one rule at the start: no research. I never checked whether anyone had built this before, because I didn’t want the internet to kill the idea before I’d written a line. As it turned out, Geoffrey Huntley already had, and I didn’t learn that until later.

A language that only works at the level of syntax is really just a costume, so I gave it one real job. Games allocate and release objects constantly, and both manual bookkeeping and garbage collection cost you frames you can’t spare. bet handles that with arenas: allocate into a scope, use it for a frame, drop the whole scope at once. The pattern itself isn’t new. Zig ships an arena allocator that frees everything in one call, and Odin bakes the same arena and temp-allocator idea in for game code. I wanted bet to carry it as a first-class feature with its own keywords, so the language would read as a design of its own rather than a slang reskin of something that already existed.

It’s a joke. I still wanted it to actually do something.

The other reason I built it was to run an experiment. I wanted to see how far an AI coding agent could get on a hard, well-specified project if I stayed out of the implementation. My job was to be the architect: I set the problem and the acceptance criteria, then held the line on them. I did zero code review. A change shipped only if it passed its tests, met the acceptance criteria, and cleared the corpus. That was the only gate.

The proof that it works is DOOM, ported in full. id Software’s original C source for the renderer, the game logic, the WAD loading, and the audio was rewritten in bet: more than 56,000 lines, compiled to a native binary that runs the real shareware game in a window.

Launch it and DOOM plays itself in attract mode. Those clips are the game’s original recorded inputs, replayed through the simulation. Fixed-point math is what makes that a real test: drift by a single step and the player starts walking into walls. bet replays the inputs in lockstep with the reference C build, frame for frame, so the whole simulation comes out bit-for-bit identical. Getting that far with no shortcuts is what separates a toy language from one that can carry real software, and it’s the result I trust most on a build I never code-reviewed.

So it finished, end to end: the compiler, self-hosting, documentation, and this site. And that is where it stops. If a feature request comes in I’ll review it, but there’s no roadmap and no version two on the way. bet was a joke and an experiment and a way to learn what a build like this actually takes, and it did all of that. If there’s one thing I want it to say about me, it’s that I finish what I start.

联系我们 contact @ memedata.com