LZ∞

From Esolang
Jump to navigation Jump to search

LZ∞ is an esolang (lazily) invented by User:Pro465 in 2023, based on LZ77 and Xeroxer. in fact, it is also an OISC like Xeroxer.

it is basically a re-encoding of a superset of Echo Tag to make it look like LZ77 compression, or a turing-complete extension of LZ77, depending on the way you look at it. (i was wrong, though it can still possibly be turing complete. see disc)

Instruction

it has only one instruction, which is as follows:

 copy idx, len | (copy the instructions from 
               ip - idx..ip - idx + len (exclusive) 
               to the end of the program, and goto 
               next instruction (ip + 1))

idx is a signed integer, while len is unsigned.

if the current command requires copying from addresses beyond the program, it is a nop. if there are no more instructions to execute, the program halts.

Python Intepreter

prog=[]
ip=0
while len(prog) > ip:
    (idx, len_) = prog[ip]
    if ip - idx >= 0 and ip - idx + len_ <= len(prog):
        prog+=prog[ip-idx:ip-idx+len_]
    ip+=1

simpler interpreter, by User:LyricLy:

for ip, (offset, l) in enumerate(prog):
    start = ip - offset
    end = start + l 
    if 0 <= start < end < len(prog):
        prog += prog[start:end]

See also