Tombstone
inferno
May 2006 โ Mar 2008 ยท age 24โ26
What it was
A data-model compiler written in C# over an ANTLR 3 grammar, built for a tower-defense game's document model. A dozen lines of declarations became C++ (or, partly, C#) classes with getters and setters, arrays whose length field carried the name the designer chose, sorted fields, XML serialization with two-pass pointer resolution, and a flat-binary format loaded straight from memory with vtables restored from a static instance. Its signature idea was ownership in the type syntax: Type * meant owned and deleted with the parent, Type *! meant merely referenced, and setters, resizers and loaders all obeyed. A pattern hook dispatched by name to code generators, such as one that emitted a sorted linked-list insert. The real work ran from December 2007 to a dense final day in March 2008. The C++ backend worked; the Java, OCaml and PHP backends were empty classes.
Wins, for the age
- At twenty-six, Jeff wrote ownership into a type syntax, owned versus borrowed, two years before Rust's ownership (2010) made that vocabulary famous. An ape with a keyboard let the grammar do the remembering.
- Restored vtables by copying a static instance over raw memory, five years before Cap'n Proto (2013) popularized zero-copy loading.
- Serialized shared references and cycles by allocating every object first and resolving pointers in a second pass.
- Built a pattern hook that could have grown pools, trees and grids, and proved it with a working sorted list.
What it taught
- A compiler for boilerplate pays for itself the first time the data model changes: 30 lines of declarations, 9 KB of code.
- Ownership belongs in the schema, where the destructor, the setter and the loader can all agree without anyone remembering.
- Owning the source language beat parsing C++ headers. The earlier approach was the wrong direction.
- Generate from templates, not from thousands of
WriteLinecalls, and test serializers by round-trip. A 1 KB copy buffer and a 1 KB function slot could not both fit.
Genealogy
Ancestors: Cauldron v2: the generated scene model and loading from memory images. Kitchen ZMLC2: the header-parsing grammar it started from, then retired. ZMLC: ownership rules and a flat format loaded with a cast. Descendants: Kitchen: the tower-defense document model and the flat-image loader. Kitchen Cauldron: the XML and flat serializer runtime, vtable trick included.
Epitaph
Here lies inferno. Thirty lines of declarations in, nine kilobytes of C++ out, and it always knew who deleted what, for a game that never got past its data.