Unicode esoteric language

Staffcode

Music you can execute. Notes become values, phrasing becomes control flow, and a ten-row staff becomes a stack machine.

10staff rows
3note families
UTF-8source files
0runtime dependencies

Pitch becomes state

A score is a program

Staffcode reads source from left to right across one or more systems. Vertical position supplies a value; notation decides what happens to it.

Quarter notes push

A note pushes its row value. Notes aligned in one column form a chord and push their sum.

Eighth notes operate

Ten selectors cover arithmetic, stack manipulation, character output and integer output.

Half notes communicate

Comparisons, logical not, integer input and character input share the same pitch system.

Score explorer

Read real Staffcode

Each selection below is a valid program from the reference repository.

This page bundles Noto Music for complete musical glyph coverage. The explorer keeps every logical source cell at a fixed width. Font license.

chord.staff

          

The staff is visually aligned for reading. Use Copy score for the exact UTF-8 source.

Advanced example

99 Bottles, one loop

The complete song is generated by a single 99-pass repeat. The current count stays on the stack while conditionals select singular, plural and no more; the final verse executes after the loop.

99loop passes
1,023instructions
46,365executed steps
43staff systems
stdout ยท excerpt
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.

                         ยทยทยท

1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.

No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.

Beyond arithmetic

Musical structure carries runtime state

โ™ฏ โ™ญ โ™ฎAccidentals update row offsets
|Barlines restore the key signature
๐„† โ‘  โ‘ก ๐„‡Repeats select numbered endings
๐„‹ ๐„‰ @ ๐„ŒD.S. replay can jump to a coda

Reference implementation

Write your first score

The repository includes the interpreter, thirteen examples, a complete language specification and more than one hundred generated conformance programs.