AETRF
Jump to navigation
Jump to search
AETRF or An Esolang That Refuses Files is an esolang invented by User:None1. If the program is read from standard input, it's the same as brainfuck, otherwise it will print:
FILE DETECTED, FAILED TO RUN
Python interpreter
import sys def bf(code): s1=[] s2=[] matches={} tape=[0]*1000000 for i,j in enumerate(code): if j=='[': s1.append(i) if j==']': m=s1.pop() matches[m]=i matches[i]=m cp=0 p=0 while cp<len(code): if code[cp]=='+': tape[p]=(tape[p]+1)%256 if code[cp]=='-': tape[p]=(tape[p]-1)%256 if code[cp]==',': tape[p]=ord(sys.stdin.read(1))%256 if code[cp]=='.': print(chr(tape[p]),end='') if code[cp]=='<': p-=1 if code[cp]=='>': p+=1 if code[cp]=='[': if not tape[p]: cp=matches[cp] if code[cp]==']': if tape[p]: cp=matches[cp] cp+=1 if sys.stdin.isatty(): bf(sys.stdin.read()) else: print('FILE DETECTED, FAILED TO RUN')