Oak

Oak is a rust-like language built on esoteric-inspired architecture. It was conceived as an alternative to C according to creator Adam McDaniel:

I wanted a language that had all the elegance of C, such as the potential simplicity of the intermediate representation, without all of the things that make C ugly and dangerous. I added stricter type checking rules to prevent simple memory errors, and a lot of the ugliness and difficulty of writing C code went away.

Its tiny back-end, built on experiments with brainfuck, is "infinitely more portable" than C. Even the smallest C compilers, designed for highly constrained environments, have around twice the number of opcodes that Oak relies on.

Oak relies on a series of earlier experiments. Like many who dabble in the esoteric arts, McDaniel began with a brainfuck variation. SMPL, written when McDaniel was in high school (he is only a college freshman now), extends brainfuck by three new commands; each is, of course, represented by a new punctuation symbol:

* Set the pointer equal to the value of the current cell
& Set the pointer back to the value it was before the last *
? With the value of the cell under the pointer, store the address of the first instance of that many consecutive zeros from the left of the tape at the current cell

While most brainfuck extensions run counter to the minimalist constraints that make the language interesting, this was done less with writing SMPL as the end goal, but building a more conventional language on top of it. By adding pointer manipulation of this kind, he could now perform dynamic memory allocation for the language he would write on top, free. He aimed to make free more powerful than brain-lang, which also generates bf but lacks free's type checking and the dynamic memory allocation made possible by SMPL.

Read More


This entry originally appeared at esoteric.codes/blog/oak, and may be a summary or abridged version.