Snowflake

After two months of work, I’ve released version 1.0 of Snowflake, a programming language and interpreter I created. You can download the source code on GitHub.

This language was designed for a rudimentary calculator-sized pocket computer I’ve been working on with my partner. If you’re wondering whether to use this for your own microcontroller project, I’d say no, and to use something like MicroPython. Mine is a toy language I made purely for fun.

Origins

Snowflake is a spin-off of another project I’ve been working on with my partner Jamie to create a calculator-sized programmable computer. The computer is intended for educational purposes, and is something in-between a 1970’s microprocessor trainer like the MOS KIM-1 and a 1980’s pocket computer like the Sharp PC-1500.

The programmable computer we’re creating has a numeric keypad for writing the programs. While machine code would be a natural fit for this input device, but I wanted to leverage the significant processing power of even the most modest microcontroller. So I created a programming language designed to work with a keypad input and extremely limited screen real-estate, that is itself something between the machine code of the KIM-1 and BASIC of the PC-1500.

The Language

Intended to help people code efficiently using a numeric keypad, the language is largely programmed using numbers. For example, here is a program called “Roll the Dice” that produces a random number between 1 and 6. The doubled semi-colons denote a comment and are ignored by the Snowflake interpreter:

;; Roll the Dice
;;
;; This program gives a random value between 1 and 6.

;; Output title.
14 00 ROLL THE DICE ;; Define string
03 00 00            ;; Output string to screen

;; Set the values.
04 03 01            ;; Store random number in Bank @01
12 02 06            ;; Store integer "06" in Bank @02

;; Provide a random number between 1 and 6.
34 01 02            ;; Bank @01 = Bank @02 % Bank @01
37 01               ;; Bank @01 = Bank @01 + 1
03 00 01            ;; Output Bank @01 to screen

This isn’t particularly readable code. The Snowflake interpreter has a –print flag that interprets these numeric values to produce a slightly more human-readable version. Using the –run flag executes the program itself:

The language is documented here while the interpreter is documented here.

The rest of the documentation is found here.

What’s Next?

With the programming language and default interpreter implementation complete, the next phase is to return working on the hardware for the programmable calculator-sized computer. I make no guarantees about that getting done, though the pandemic induced lock down is certainly helping productivity.

Coding Snowflake.