Makeshift Programming Language


A dead-simple programming language.

software (29) zig (14) programming-language (7)

Table of Contents
  1. Backgrounds
  2. Constraints
  3. Syntax
  4. Status
  5. Links

Select anchorBackgrounds

I was working on the Ashet Home Computer back when it was to be made with the SPU Mark II, a small 16 bit cpu and figured I need a programming language to be compiled on that machine.

As the environment was heavily resource constrained, no modern programming language was an option. As usual, I decided to create a new language.

Select anchorConstraints

The design constraints of this language were to be as simple as possible, with as little features as possible while still kinda counting as a modern imperative programming language.

Makeshift has only a single type called word, an unsigned machine-wide integer. It can be indexed (and is used as a pointer then), it can be called (and is used as a function pointer), and you can do arithmetic with it. This way, basically no type system has to implement. Functions implicitly return an integer, if you don’t do a return, 0 will be returned.

Select anchorSyntax

Makeshift is a very C/Zig like syntax, with curly braces for both arrays and block delimiting. The operators are mostly what you’d expect, except for the <val>@(<offset>) operator, which performs not word, but byte indexing into memory. { ... } is an operator that returns a pointer to the contained sequence of bytes with a lifetime of the current scope. Thus, making text a NUL terminated string with three characters.

const text = { 48, 48, 55, 0 };

fn strlen(ptr) {
  var len = 0;
  while(ptr@(len)) {
    len = len + 1;
  return len;

fn main() {
  return strlen(text);

So this program will just compute the length of text and returns it from main.

Select anchorStatus

I tried to implement a compiler in Zig, but I already got too excited about compile time evaluation and ran into complications. Right now, the project is in hiatus, but I want to revive it and fix some design flaws:

I still think the language is a cool thing to implement and bootstrap, and was designed as a bootstrapping language that should still be relatively easily compiled. Optimizations are always a good thing, but they aren’t really necessary.

Select anchorLinks