Writing a Spec Before Writing Code
Hew started with a 394-line specification, a 1,076-line gap analysis, and four research documents — before any compiler code existed.
16 parts
Hew started with a 394-line specification, a 1,076-line gap analysis, and four research documents — before any compiler code existed.
Building Hew's lexer, parser, type checker, IR, and C codegen in under two hours. Fibonacci printed 55.
From one-thread-per-actor to M:N work-stealing — designing Hew's actor runtime, mailboxes, and supervision trees.
Three major spec revisions driven by implementation and user testing — ownership rethink, messaging overhaul, and syntax consolidation.
Why Hew ended up with two compilers — the Rust/Inkwell attempt, the pivot to C++/MLIR, and rebuilding the pipeline in 12 hours.
Benchmarking Hew against gcc -O2, setting up CI, and adding generators to the spec.
The v0.6.0 spec revision removed six redundancies and three dead-end features without adding anything new.
Spec v0.6.1 added three generator forms to Hew, including one that streams values across actor boundaries through the mailbox.
Writing fifteen programs from scratch to find UX problems, then fixing error messages, adding else-if chains, and killing false positives.
Building a TextMate grammar, replacing LLVM IR with typed Hew dialect ops, and debugging a Tailwind naming collision.
Ripping out FlatBuffers, splitting the standard library namespace, adding a package manager, and building an export macro system.
Walking through the Hew pipeline to fix broken tail calls, unregistered defer, SQL injection in the stdlib, duration literals stuck at the lexer, and 120 new tests.
Systematic memory validation with valgrind — from 1,800 bytes definitely lost to zero, fixing reply channel leaks, supervisor cleanup, and a nested shutdown double-free.
Removing seven syntax forms, adding named arguments, fixing the formatter, and collapsing three crates into one before tagging v0.1.0-alpha.
Fixing generic monomorphization collisions, wiring codegen to the type checker, adding MLIR verification, and building IR visualization tools.
I removed the alpha suffix and immediately had to build a release pipeline that could actually ship the thing.