From Esolang
Jump to navigation Jump to search
Paradigm(s) imperative
turing tarpit
Designed by User:Dragoneater67
Appeared in 2026
Memory system Cell-based
Dimensions one-dimensional
Computational class Turing complete
Major implementations C++
Influenced by #b
!I!M!P!O!S!S!I!B!L!E!
Brainfuck
File extension(s) .hammerandsickle

is a turing complete esoteric programming language. The goal of the language is to make doing trivial operations nearly impossible.

Overview

The language is separated into 2 phases of execution. The overview is very brief as it is hard to explain the workings of ☭. Refer to the reference implementation to get a better understanding of the language.

Phase 1

Phase 1 reads the source string character-by-character and executes a command. Before each command is executed g is regenerated using LCG (the initial seed for g is ). The command is determined by this formula ( is the current character, is the position of the current character):

Selector Type Operation
0 State mutation Mutates internal accumulators and shifts keys:
  • a += 3
  • w += 7
  • q -= 43 (Input key rotation)
  • p -= 13 (Memory pointer shift)
  • g ^= 0xCAFEBABE (PRNG scramble)
1 State mutation Mutates internal accumulators and shifts keys:
  • a -= 2
  • w -= 5
  • q += 67 (Input key rotation)
  • p += 17 (Memory pointer shift)
  • g += a ^ w (PRNG mix)
2 Instruction generation Synthesizes a candidate byte b using the formula:


If b is a valid instruction (*, #, or ?), it is appended to the Phase 2 instruction tape.
If b is invalid, the PRNG is penalized (g = 0xDEADBEEF).

Phase 2

Phase 2 is a virtual machine that executes the bytecode generated in phase 1. The virtual machine has:

  • The memory tape with the length of bytes
  • The instruction tape with the length of bytes
  • The memory pointer
  • The instruction pointer

The memory pointer is initially pseudorandom (derived from the source string), while the instruction pointer is always initialized to . Instructions are single ASCII characters, any other ASCII character is an invalid character and will result in an error. 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 forward by 999983 positions.
Instruction pointer is Even Reads a byte from input, XORs it with register q, and stores it in the current memory cell, then jumps back 2 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 backward by 999979 positions, then adds 241 to the current memory cell.
? Memory pointer is Odd Outputs the character at the current memory cell XORed with register h, then adds 239 to the current memory cell.
Memory pointer is Even If current memory cell is 0, skip forward 13 instructions. Otherwise, set both memory pointer and the instruction pointer to pseudo-random values derived from g.

The virtual machine has the following internal registers:

  • a (phase 1 only, does not affect the state of the virtual machine)
  • w (phase 1 only, does not affect the state of the virtual machine)
  • h (the rolling encryption key for output)
  • q (the rolling encryption key for input)
  • p (the memory pointer)
  • j (the instruction count)
  • y (the instruction pointer)
  • g (pseudo-random value)

After each instruction is executed the new h is calculated using this formula ( is current memory cell value and is the current instruction):

Computational class

☭ as mentioned earlier, is turing complete, but may be considered a turing tarpit by some.

  • The * and # instructions allow for arbitrary arithmetic operations since they can increment values of memory cells
  • The ? and # instructions allow for complex control flow because of conditional jumps and self-modifying code
  • The * and ? instructions allow for input/output operations, although not required for turing completeness, they are still very useful for some use cases (such as printing "Hello world!")

Examples

No ☭ program has been discovered yet.

External resources