HN
Today

56,000 lines of DOOM, in a language I made up

A developer created 'betlang,' a new programming language featuring playful slang keywords but powered by a serious LLVM compiler and novel arena memory management. The language was developed as an experiment, largely by an AI coding agent, and proved its mettle by successfully porting and running 56,000 lines of DOOM. This project captivated Hacker News by showcasing a unique blend of technical prowess, experimental development with AI, and a refreshingly 'finished' scope.

13
Score
11
Comments
#8
Highest Rank
3h
on Front Page
First Seen
Jul 16, 5:00 PM
Last Seen
Jul 16, 7:00 PM
Rank Over Time
82526

The Lowdown

This story introduces 'betlang,' a quirky yet robust programming language. Designed as a contained experiment, it marries a surface-level 'joke language' featuring slang keywords with a high-performance LLVM compiler underneath.

  • Core Innovation: betlang's standout feature is its first-class support for arena memory management, with keywords like crib and evict. This design aims to provide efficient, O(1) memory release per frame, particularly beneficial for game development, drawing inspiration from languages like Zig and Odin.
  • Development Process: The author adopted an unconventional approach, acting as an architect who set the problem and acceptance criteria, while an AI coding agent handled the implementation. Crucially, there was zero manual code review; changes were accepted solely based on passing tests and meeting criteria.
  • Validation: The ultimate proof of concept was the successful porting of DOOM. The original 56,000 lines of C source code for DOOM's renderer, game logic, WAD loading, and audio were rewritten in betlang.
  • Precision Test: The DOOM port achieved bit-for-bit identical simulation replay with the original C version, especially critical for fixed-point math, signifying its accuracy and robustness.
  • Project Scope: The project, encompassing the compiler, self-hosting, documentation, and website, is declared complete, with no roadmap for future development, emphasizing the author's goal of finishing what they start.
  • Time Investment: A detailed breakdown of development hours is provided, indicating that porting games (DOOM, Oregon Trail, Pong) consumed the majority of the active effort.

In conclusion, 'betlang' stands as a testament to the author's skill in conceptualizing and executing a complex technical project, demonstrating how serious engineering can be wrapped in a playful, experimental package, even with significant AI assistance.

The Gossip

AI's Architectural Ascent

Discussion revolved around the author's use of an AI coding agent to implement `betlang`. Some commenters questioned the transparency and credit given to AI, arguing it significantly changes the perception of the project's difficulty. Others dove into how AI can genuinely assist in complex tasks like compiler development, especially with proper specification and testing, contrasting their own slower experiences with AI-assisted coding.

Syntax Sensitivity

A point of contention arose regarding `betlang`'s use of slang keywords. One commenter expressed concern that the 'joke' aspect could be perceived as mischaracterizing or appropriating African American Vernacular English (AAVE), prompting a debate on whether such language is widely used by teenagers regardless of race or if it crosses a line into cultural insensitivity.

Crafting Creative Compilers

Many commenters resonated with the spirit of creating a 'joke language' or a language with a quirky syntax, sharing their own past or ongoing projects. These anecdotes often highlighted the fun and learning involved in such endeavors, from C preprocessor tricks to full-fledged language experiments, reinforcing the idea that humor can be a powerful motivator in deep technical exploration.