I have a confession that will surprise nobody who has read this blog before: I
decided to write my own programming language. Not learn one. Write one.
The justification, such as it was: I write shell scripts for the home server,
and bash is what happens when forty years of good intentions are stapled
together and made load-bearing. I wanted something I could actually read back
a month later. And more honestly than that — I wanted to know how programming
languages work, because for twenty years they’d been the one bit of
computing I filed under “wizardry, do not open”.
Specifically, two words had always done the filing: lexing and
parsing. I knew roughly that a compiler reads your code and turns it into
something a machine can run, and I knew the people who built them were a
different species of programmer. Books on the subject have dragons on the
cover. That is not a welcoming sign.
So naturally I opened a terminal at breakfast, with an AI pair-programmer on
the other side of it, and said: let’s make one. It’s called lippy — a
language where you write if guess equals secret then instead of
if (guess == secret) {, where a newline ends a statement because of course
it does, and where the error messages are required — by written specification
— to be kind.
And here’s the thing nobody had told me, the thing I’d have paid money to
know twenty years ago: we did not start with the dragon books. We did not
start with code at all. The first thing we built was ten example programs
in a language that didn’t exist — a backup script, a disk-space alert,
fizzbuzz, a number-guessing game — written as if lippy were already real,
just to see how it read aloud.
By the time I’d finished arguing with myself about whether = should mean
“equals” (it shouldn’t; the word equals should), the language was
designed and not one line of Go existed. Then it was time to open the box
marked “wizardry” and find out what a lexer actually is.