c4 (“C in four functions”; GitHub)

I remember coming across c4 when it was released ten years ago. It got me excited: hey, C in four functions, that means it’s easy to understand right?

That excitement turned into “oh, I see” as soon as I scrolled through the code. c4 is dense, barely commented, and, frankly, strange. It’s unlike anything else I had come across in compiler land.

After reading through the code this week here are the other adjectives I would add to the list: clever, tricky, fascinating, cool. It’s a compiler, it’s a VM, it’s an interpreter, it’s a parser, it’s art, it’s trickshot programming.

I mean, look at this:

Code screenshot

Not to be confused with C3, “a programming language that builds on the syntax and semantics of the C language, with the goal of evolving it while still retaining familiarity for C programmers”.