Tombstone
kitchen · zmlc2
Nov 2005 – Mar 2008 · age 23–26
What it was
The schema compiler at the center of the kitchen engine; its banner read "Fire : Version 1.5". It parsed a language that looked like a C++ header on purpose: classes, typed fields, pointers, sized arrays whose length field the author named, and note() strings carrying a category and a description. From that it emitted C++ classes with accessors, reflection, equality, an XML serializer and a flat-binary serializer that loaded by vtable transplant; a C# mirror whose properties carried property-grid categories and tooltips taken from the notes; load helpers; and a field map for the scripting compiler. About 630 lines of schema became roughly 28,000 lines of generated code, regenerated on every build and never edited by hand. It was in daily use until the week the engine stopped.
Wins, for the age
- At twenty-three, Jeff started a compiler in which one schema drove five artifacts, and by 2007 it was doing so every day, concurrent with Protocol Buffers going public in 2008.
- Generated the vtable-transplant loader, so files became object graphs by a copy and a fix-up pass, six years before Cap'n Proto (2013).
- Turned schema comments into editor metadata, a small idea with a large payoff, finding on their own what UnrealScript's editable properties had found in 1998.
- Kept one tool alive across two engines and treated its output as disposable: a primate trusting its own generator, rightly.
What it taught
- A schema compiler is the highest-leverage tool a solo engine developer can write.
- An AST you can print and re-read is easier to debug than one walked by generated visitors, at the cost of a second parser.
- Constraints in the schema are cheaper than bugs in the output; the error messages were the design decisions.
- String concatenation has precedence.
"Unknown = " + Max+1appended a digit and declared a class count of 241. Escape your output, and keep one copy of the runtime per language.
Genealogy
Ancestors: Cauldron v2: the engine whose 74-class schema proved generation worked. Cauldron v2 ZMLC: the same compiler one version earlier, with its C API. ZMLC: the original header-shaped language and its flat binary format. Descendants: Goat Lamancha: schema-first generation again, with the schema written as C#. Inferno: its header-parsing grammar, the starting point before inferno owned its language. Kitchen Pantry: generated classes that became the asset tool's property pages. Part of: Kitchen.
Epitaph
Here lies zmlc2. Six hundred lines of schema in, twenty-eight thousand lines of engine, editor and script glue out, from a compiler older than the engine it served.