Nilo

Journal1

Written by AI so you can code by hand

I have built my own tools since 1999. Every few years I throw them out and start again. This time I am doing it differently, and I want to keep a record of it here as it happens.

The new tool is a language called Nilo. It is small and it does one thing: it describes a piece of art, and a compiler turns that description into the smallest piece of JavaScript it can.

I am not writing the compiler. A model is. I say what I want the language to be, I read what comes back, I argue with it, and I draw with the result. That is the whole idea, and it is the tag line:

Written by AI so you can code by hand.

The hard, dull part of a language is the machinery under it. A compiler, a minifier, a hundred rules about what is allowed. That is the part I have handed over. The part I keep is the part I care about: a short file I can read from top to bottom, where every line is about the art.

Why bother

Because I still like creating by hand.

A model can write a whole piece for me now, and sometimes that is useful. But the part of this work I love is writing it myself: saying exactly what I see, in as few lines as I can. I do not want to give that up. I want a tool that keeps it.

Most code a model writes is hard to keep working on by hand. It is long, it is full of machinery, and the art is buried somewhere inside it. So I turned the problem round. Let the model build the tool, and make the tool so small and plain that the piece itself stays mine to write.

There is a practical side too. My work goes on chain, where every byte is paid for and stays there. My current stack ships a large runtime with every piece. One recent piece came to about 360,000 characters, and a quarter of that was machinery the art never asked for.

So I wanted three things:

  1. I can be completely expressive in as few lines as possible.
  2. The language is geared entirely to creative output. Nothing in it is there for any other kind of program.
  3. What ships is as small as it can be, with nothing I did not use.

Where it stands today

  • One real layer of a finished piece, about 80,000 brush strokes, rewritten in Nilo. It matches the original stroke for stroke, and ships in 10,212 bytes against 22,060.
  • A first set of libraries, written in Nilo itself: noise, colour and one brush.
  • A first new piece made with them. The file is 35 lines. It ships as 5,449 bytes.

Brush sweeps following a flow, in rust and ochre

This is a test of the brush, not a finished work. The strokes are spread too evenly and there is no composition yet. But the file that made it fits on one screen.

What went wrong

Plenty. The first time a model was given only the reference page and asked to write a piece, it took fourteen attempts, and twelve of them failed. The page was missing things, and the error messages said what was wrong without saying what to write instead. Both are fixed now, and the second test went as smoothly as plain JavaScript.

The language also had a different name at first. Two more were tried and dropped for sounding bleak.

I will keep the failures in this record. They are most of the story.

What is next

I have not yet written a piece in Nilo by hand myself. Until I do, the tag line is a promise and not a fact. That is the next entry.