Skip to content

Repository files navigation

SNARL

Self-Nullifying Anachronistic Rotational Language

An honest-to-god working esoteric programming language. It's Turing-complete and every example below has actually been run through the interpreter — this isn't a mockup. It is also, by design, miserable to hand-write: which stack an operator touches depends on a global rotating "phase" counter you don't control, and most instructions physically erode and vanish after 5 uses unless your program rewrites itself at runtime to survive.

Full language rules: see SPEC.md.

Requirements

Python 3.8+. No dependencies.

Running a program

python3 snarl.py examples/hello_world.snarl

Add --trace to print a step-by-step execution log to stderr (position, instruction, phase, all three stacks, direction) — you will want this constantly while debugging:

python3 snarl.py examples/hi.snarl --trace

Add --max-steps N to cap execution (default 2,000,000) — useful since SNARL programs can loop forever, especially once you start relying on the grid's toroidal wraparound as a loop construct:

python3 snarl.py examples/decay_demo.snarl --max-steps 100

The included examples

File What it shows
examples/hi.snarl Minimal verified "Hi" — the baseline sanity check
examples/hello_world.snarl Full "Hello, World!" generated by gen_print.py
examples/snarl_name.snarl Prints "SNARL"
examples/decay_demo.snarl A single-row program that loops forever via toroidal wraparound. Its output instruction has durability 5, so it prints exactly AAAAA and then goes permanently, silently quiet — the instruction that used to be there is just gone. This is the core "hard to use" mechanic in isolation.
examples/selfwrite_demo.snarl Uses X to write a brand-new , instruction into a blank cell at runtime, then executes the cell it just created. Self-modification, verified working.

Run any of them, or --trace them to see exactly what the phase/stack machinery is doing at each step.

Writing your own programs

Hand-writing SNARL means constantly tracking: what phase will execution be at when it reaches this cell, which of the 3 stacks does that map to, and how many more times can this cell fire before it erases itself. The one lever you have is padding — inserting no-op space cells to shift when (and therefore which stack) a later instruction lands on. See the "Why This Is Hard" section of SPEC.md for the padding rule that makes this tractable rather than impossible.

gen_print.py — a minimal compiler

Hand-computing base-3 digit strings and phase-alignment padding for every character of a string you want to print is exactly the kind of thing SNARL is designed to make tedious. gen_print.py does it for you:

python3 gen_print.py "Hello, World!" > mymessage.snarl
python3 snarl.py mymessage.snarl

It only handles straight-line "print this string" programs — everything involving loops, branching, or self-modification still has to be built by hand, on the grid, against the decay clock.

Uploading / packaging

This whole snarl/ folder is self-contained:

snarl/
├── README.md
├── SPEC.md
├── snarl.py
├── gen_print.py
└── examples/
    ├── hi.snarl
    ├── hello_world.snarl
    ├── snarl_name.snarl
    ├── decay_demo.snarl
    └── selfwrite_demo.snarl

Zip it or upload the folder as-is — there's nothing else to install.

About

SNARL: a 2D grid-based esoteric language with self-erasing instructions and phase-rotating stack selection. Loops rot unless your code rewrites itself to survive.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages