这不是编程语言!

From Esolang
Jump to navigation Jump to search

这不是编程语言!is an esolang created by User:None1.In Chinese, 这不是编程语言! means "This is not a programming language!", but it is a programming language.

Introduction

这不是编程语言! is equivalent to Brainfuck,each character in its name stands for a command in brainfuck.

这 stands for + in brainfuck

不 stands for - in brainfuck

是 stands for , in brainfuck

编 stands for . in brainfuck

程 stands for < in brainfuck

语 stands for > in brainfuck

言 stands for [ in brainfuck

! stands for ] in brainfuck

Example Programs

Cat Program

这言是编!

Nope. interpreter

这这这这这这言语这这这这这这这这这这这这这程不!语编语这这这这这这这这这这这言语这这这这这这这这这这程不!语这编这编不
不不不不不不不不不不编语这这这这这言语这这这这这这这这这程不!语这编

Hello World

这这这这这这这这言语这这这这言语这这语这这这语这这这语这程程程程不!语这语这语不语语这言程!程不!
语语编语不不不编这这这这这这这编编这这这编语语编程不编程编这这这编不不不不不不编不不不不不不不不
编语语这编语这这编

Truth Machine

语语语是编言言不语这程程这语!语不!程程程言程程!语言编!

Interpreters

Python

This interpreter resembles the one for #b (a.k.a. Sharp flat).

import sys
def zb(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
zb(sys.stdin.read())