_*_ _
 / \

hex

\* programming language *\_/_/_/ *

About

The core idea behind hex is to be a really small language for experimenting with the concatenative programming paradigm and at the same time being somewhat useful for practical things like creating short scripts or be used as glue code for automating common tasks.

How hex was born

When I first implemented min, the intent was to create a minimal language, hence the name. The reality however turned out to be very different: in no time, I found myself adding a lot of syntactic sugar, complex data types, support for XML processing and HTTP client and server... it became more of a batteries-included language with a somewhat spartan syntax than anything else.

The second attempt was to essentially fork part of the min codebase and create mn, which was a lot more limited, but still not minimal enough. The one thing that was bothering me the most was, in the end, the fact that it was implemented in Nim. Not that Nim is a bad language (quite the opposite!), but I really wanted to keep things simple, and implement something in C.

And that's how hex was born! Actually... I started off asking ChatGPT to implement a tokenizer for a small stack-based language able to process integers, then an interpreter, then I asked for string support, and then... well, the boilerplate wasn't too bad. A few tweaks here and there and I was able to improve a few things, and in a few days I realized that I had re-learnt some C programming skills I hadn't been using in the past 20 years!

So there you have it. A language that is purely concatenative, truly minimalist and yet powerful enough, limited to 64 native symbols and yet manages to be somewhat useful, hopefully. The fact that I could get it to compile to WASM with just a few hours worth of extra work (mainly to manage stdin properly) also meant that this little thing also has its own browser-based playground!

The only annoying thing is that it only understands hexadecimal integers. Well... I figured I could take a little poetic license, and introduce a small quirk that would justify its nice, almost magical, three letter name!

About the logo

The hex logo is a small ASCII art representing a horizontal stack of three hexagons, each one representing a stack element.

      _*_ _
     / \hex\* 
    *\_/_/_/ 
         *
It also features four stars, representing the the 64 native symbols provided by the language (four times 16, so 0x40 in hexadecimal format). They also hint at the magic of the language itself, and the dual meaning of the word hex (as in hexadecimal and spell).

About this web site

This web site aims to be very simple and minimalist, like hex itself. It is written in HTML with minimal CSS, and it is processed using a minimal static-site generator implemented in hex itself.