☭
| Paradigm(s) | Imperative |
|---|---|
| Designed by | User:Dragoneater67 |
| Appeared in | 2026 |
| Memory system | Cell-based |
| Dimensions | One-dimensional |
| Computational class | Unknown |
| Reference implementation | C++ |
| Influenced by | #b !I!M!P!O!S!S!I!B!L!E! Brainfuck |
| Influenced | ⌬ |
| File extension(s) | .hammerandsickle .☭ .has |
☭ (a.k.a. HAMMERANDSICKLE) is an esoteric programming language with the goal of making programming nearly impossible.
Overview
The language is split into 2 phases of execution.
Phase 1
Phase 1 reads the source string character-by-character and executes a command. It has 8 internal registers:
a(uint8, does not affect phase 2)w(uint8, does not affect phase 2)h(uint8, the rolling encryption key for output)q(uint8, the rolling encryption key for input)p(unbounded, the memory pointer)j(unbounded, the instruction count)y(unbounded, the instruction pointer)g(uint32, PRNG)
They are initialized with these values:
q = '?' h = '#' g = 89404137
The rest are initialized to .
Before each command is executed g is recalculated using this formula:
The command is determined by this formula ( is the generated command, is the current character, is the position of the current character):
| Command | Operation |
|---|---|
| 0 |
|
| 1 |
|
| 2 | Generates a character b using this formula:
|
(NOTE: p wraps around in the reference implementation because memory tape is bounded there)
Phase 2
Phase 2 is a virtual machine that executes the bytecode generated in phase 1. The virtual machine has:
- The unbounded memory tape (in the reference implementation the length is )
- The unbounded instruction tape (in the reference implementation the length is )
- The memory pointer (in the reference implementation it wraps around)
- The instruction pointer
The memory pointer is initially pseudorandom (value of p by the time phase 1 ended), while the instruction pointer is always initialized to . Instructions are single ASCII characters, any other character is invalid and will result in a crash. Here is a quick overview of available commands:
| Instruction | Condition | Operation |
|---|---|---|
| * | Instruction pointer is Odd | Adds 251 to the current memory cell, then moves the memory pointer right by 999983 positions. |
| Instruction pointer is Even | Reads a character of input, XORs it with register q, and stores it in the current memory cell, then jumps back 3 steps.
| |
| # | Current memory cell is 0 | Jumps back 7 steps, then modifies the instruction at that location by cycling it (* → # → ? → * → ...).
|
| Current memory cell is not 0 | Moves the memory pointer left by 999979 positions, then adds 241 to the current memory cell. | |
| ? | Memory pointer is Odd | Outputs the character at the current memory cell XORred with the register h, then adds 239 to the current memory cell.
|
| Memory pointer is Even | If current memory cell is 0, skip forward 12 instructions. Otherwise, set both memory pointer to g and the instruction pointer to g mod j.
|
After each instruction is executed:
yis incremented by 1qis incremented by 197his recalculated using this formula ( is current memory cell value and is the current instruction):
Examples
XKCD Random Number
iKrupBIJ2Ge7eJB6Wjav-stfem+d8zvCao9=a60U29ceE0KStlgieCyrUoCq0n = xkcd(36);
Shorter version
iKXXXSo[pLw7eP$K$W
(NOTE: Most text editors insert a newline at the end of a file, if it fails, that is probably the reason)