Abyssal-7

From Esolang
Jump to navigation Jump to search
Abyssal-7
Paradigm(s) imperative
Designed by User:Sawyer.go0923
Appeared in 2025
Computational class Turing complete
Reference implementation
Influenced by Abyssal-8, Abyssal-9, Malbolge
File extension(s) .aby7 or .aby7t

Abyssal-7 (subtitled Bitstream Prelude) is an esoteric programming language designed in 2025 as a conceptual predecessor in the Abyssal family, positioned between the fixed trit-cipher madness of Malbolge and the escalated byte-overlap chaos of Abyssal-8 and trit-PoW entropy of Abyssal-9. It processes programs as raw bitstreams through overlapping 1–3-bit windows, with instructions resolved via a deterministic, file-seeded bijection map. Features include light "verification drift" (a mini-PoW check), occasional map rotations for self-modification, and Feistel-permuted addressing. Everything is strictly deterministic and derived from the file contents, emphasizing unportability and anti-debugging while remaining Turing-complete via a permuted Brainfuck-like core.

Abyssal-7 strikes a difficulty balance: harder than Malbolge's rigid enciphering (due to per-file seeds and overlaps forcing simulation) but easier than its successors (bit-scale windows, cheap drifts, predictable rotates—no heavy CNF, dynamic bijections, or plane deinterleaving).

Syntax

Programs are continuous bitstreams, optionally in text form as sequences of '0' and '1' characters (other chars ignored).

  • Header: Fixed first 32 bits: 01010110101010101111000000001111. Invalid headers halt with error byte 0xFF.
  • Body: All subsequent bits form the executable stream.
  • File Extensions: .aby7 (binary) or .aby7t (text).
  • Comments: None; extraneous bits may alias into windows and affect execution.
  • Invocation: Interpreter reads stdin bytes, writes to stdout. Optional argument N (decimal) XORs into the map seed for variants.

Memory Model

  • Tape: Infinite array of signed 8-bit cells (wrapping at ±128), initialized to 0.
  • Pointer (P): Starts at 0; movements use permuted deltas (1–4 cells).
  • Stack: 128-entry LIFO for conditional jumps, with indices permuted.
  • Global Accumulator (G): 32-bit value, updated via XOR of last instruction result, IP, and P.
  • Permutation: Addresses (P, stack indices) remapped via a 4-round Feistel network keyed by a 32-bit seed S_perm derived from the body's prefix hash. Logical address L maps to physical = Feistel(L XOR S_perm).

Tokenization and Execution

The bitstream (post-header) is processed starting at bit position IP = 32.

  • Windows: At IP, extract overlapping candidates:
    • W1: bit[IP] (1 bit)
    • W2: bit[IP:IP+2] (2 bits)
    • W3: bit[IP:IP+3] (3 bits)
  • Resolution:
    1. Compute score for each Wk: (SHA-256(Wk + last 8 bits of G) % 10) + len(Wk) (ties favor longer).
    2. Select highest-scoring Wk.
    3. Drift Check: SHA-256(Wk + bin(G)). If fewer than 2 trailing zero bits, advance IP by (low 2 bits of hash % 3) + 1 and retry (up to 3 times, then NOP).
    4. Interpret selected Wk (as integer 0–7) via map M.
  • Advance: IP += 1 + (G % 2).
  • Halts: On bitstream EOF, stack underflow, or 255 consecutive NOPs.

Instruction Map (M)

  • Derivation: From first 64 body bits (prefix). S_map = SHA-256(prefix)[:4] as int. Use Fisher-Yates (seeded by S_map) to shuffle 7 opcodes and assign to patterns 0 (000) through 7 (111). (1- and 2-bit windows zero-pad to 3 bits implicitly.)
  • Opcodes (example unpermuted assignment; actual varies per file):
Pattern (bin) Opcode Effect
000 INC cell[phys(P)] += 1
001 DEC cell[phys(P)] -= 1
010 RITE P += Feistel(1 + (G % 4), S_perm) % 5 + 1
011 LEFT P -= Feistel(1 + (G % 4), S_perm) % 5 + 1
100 JZER If cell[phys(P)] == 0, IP += Feistel(next 3 bits as int, S_perm) % 8
101 OUTP Output cell[phys(P)] % 256 as byte to stdout
110 INPT cell[phys(P)] = ord(stdin byte or 0)
111 ROTM Rotate M's assignments left by (G % 7)
  • Self-Modification: ROTM shifts the map cyclically. Triggers naturally or every ~16 instructions via G.

All seeds (S_map, S_perm, S_drift) derive from HKDF expansion of SHA-256(full body)[:32], ensuring determinism.

Input/Output

  • INPT: Reads byte from stdin (0 on EOF).
  • OUTP: Writes byte to stdout.
  • Execution is fully reproducible given the same file and input.

Examples

Hello World

A full "Hello, World!\n" program would be around 100–200 bits, derivable via a generator tool simulating maps and overlaps. Example snippet for "H" (assuming a sample permutation; actual bits vary):

Header + body: 010101101010101011110000000011111011001101001011 (text form)

This might resolve to an INC chain setting cell[0] to 72, then OUTP.

Cat Program

Repeating pattern like 11010101 × 32 bits (shuffles to INPT → OUTP → RITE loop, with JZER for EOF check).

Implementation

A reference interpreter can be implemented in Python (see sketch in design notes). Key challenges: handling infinite tape (use dict or list extension), accurate Feistel (simplified 32-bit), and bitstring manipulation.

For writing programs, a genetic algorithm or backtracking generator is recommended to evolve bit patterns matching desired opcode sequences, accounting for drifts and rotates.

Relation to Family

  • Precedes Abyssal-8's byte windows and history-sensitive resolution.
  • Echoes Abyssal-9's verification but with cheaper drifts over PoW/CNF.
  • Harder than Malbolge due to dynamic maps/overlaps, but feasible for short programs without brute-force epochs.