☭
| 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,int64in the reference implementation, the phase 2 memory pointer)j(unbounded,int64in the reference implementation, the phase 2 instruction count)y(unbounded,int64in the reference implementation, the phase 2 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 (where is the current character):
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:
|
Phase 2
Phase 2 is a virtual machine that executes the bytecode generated in phase 1. The virtual machine has:
- The unbounded memory tape (
int8) - The unbounded instruction tape (
int8) - The memory pointer (unbounded, register
p) - The instruction pointer (unbounded, register
y)
Instructions are single ASCII characters. 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 instructions.
| |
| # | Current memory cell is 0 | Jumps back 7 instructions, 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, jump forward 12 instructions. Otherwise, set both memory pointer and the instruction pointer to g mod j.
|
Any other character is invalid and results in a crash (non-zero exit code). After each instruction is executed:
his recalculated using this formula ( is current memory cell value and is the current instruction):qis incremented by 197yis incremented by 1
The program halts when the instruction pointer goes out of bounds.
Examples
XKCD Random Number
i[G`G0000 T2dySddP>.M!
(NOTE: Most text editors insert a newline at the end of a file, if it fails, that is probably the reason)