啊!

From Esolang
Jump to navigation Jump to search

"啊!" is a Esolang same as "Ook!".

The founders of the "Ook!" thought that the programming language could even be learned by orangutans, so they didn't open up the comment function.

If you wanna learn "啊!", you must learn Brainf*ck.

The syntax

"啊!" has only THREE SYMBOLS (but 8 commands): "啊。", "啊?" and "啊!".

Caption text
啊! Brainf*ck Mean
啊。啊? > Move the pointer one cell to the right.
啊?啊。 < Move the pointer one cell to the left.
啊。啊。 + Increase the pointed data.
啊!啊! - Decrease the pointed data.
啊。啊! , Read a character from STDIN and dump its Unicode into the cell.
啊!啊。 . Print the character with Unicode value equal to the value in the cell pointed at by the Memory Pointer.
啊!啊? [ Move to the command following the matching 啊?啊! if the value in the cell pointed at by the Memory Pointer is zero. Note that 啊!啊? and 啊?啊! commands nest like pairs of parentheses, and matching pairs are defined in the same way as for parentheses.
啊?啊! ] Move to the command following the matching 啊!啊? if the value in the cell pointed at by the Memory Pointer is non-zero.
啊?啊? NOP It didn't do anything, just wait for 1 seconds...

So, a 啊! program needs even number(such as 2, 4, 6 or 8) "啊!"'s.

Programs

Hello, world

啊。啊。啊。啊。啊。啊。啊。啊。
啊。啊。啊。啊。啊。啊。啊。啊。 
啊!啊?啊!啊!啊。啊?啊。啊。
啊。啊。啊。啊。啊。啊。啊。啊。
啊。啊。啊。啊。啊。啊。啊?啊。啊?啊!啊。啊?
啊。啊。啊。啊。啊。啊。啊。啊。
啊。啊。啊。啊。啊。啊。啊。啊。啊!啊。啊?啊。
啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊!啊?啊!啊!啊。啊?
啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊?啊。啊?啊!啊。啊?啊。啊。啊。啊。啊。啊。啊。啊。啊!啊。
啊。啊。啊。啊。啊。啊。啊。啊。
啊。啊。啊。啊。啊。啊。啊!啊。啊!啊。啊。啊。啊。啊。啊。啊。
啊!啊。啊?啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。
啊。啊。啊。啊。啊。啊。啊!啊?啊!啊!啊。啊?
啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!
啊!啊!啊!啊!啊!啊!啊?啊。啊?啊!啊。啊?啊!啊!啊!啊!啊!啊!啊!啊。啊?啊。啊。啊。啊。啊。
啊。啊。啊!啊?啊!啊!啊。啊?啊!啊!啊!啊!啊!啊!啊?啊。啊?啊!啊。啊?啊!啊!啊!啊!啊!啊!
啊!啊。啊?啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊!啊?啊!啊!
啊。啊?啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊?啊。啊?啊!啊。啊?啊。啊。啊。啊。
啊。啊。啊。啊。啊。啊。啊。啊。啊!啊。啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊。啊。啊。啊。啊。啊。啊。
啊!啊。啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊。啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!啊。
啊?啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊。啊!啊?啊!啊!啊。啊?啊!啊!啊!啊!啊!啊!啊!啊!啊!啊!
啊!啊!啊!啊!啊!啊!啊?啊。啊?啊!啊。啊?啊!啊!啊!啊!啊!啊!啊!啊。啊?啊。

A+B problem

Too long and it is only support 1-digit addition. See more version at 啊!/A+B Problem.

Do nothing

啊?啊?

99 bottles of beers

QUITE LONG. SEE SHA512 AT 啊!/99 bottles of beer.

Interpreter

Here is a Python interpreter.

Python

By User:None1

import sys,io
def bf(code):
    s=[]
    matches={}
    tape=[0]*1000000
    for i,j in enumerate(code):
        if j=='[':
            s.append(i)
        if j==']':
            m=s.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]==',':
            c=sys.stdin.read(1)
            tape[p]=(ord(c) if c else 0)%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]
        if code[cp]=='0':
            pass
        cp+=1
code=''.join(sys.stdin.read().split())
tobf_dict={'啊。啊?': '>', '啊?啊。': '<', '啊。啊。': '+', '啊!啊!': '-', '啊。啊!': ',', '啊!啊。': '.', '啊!啊?': '[', '啊?啊!': ']', '啊?啊?': '0'}
stream=io.StringIO(code)
bf_program=''
cmd=''
while 1:
    cmd=stream.read(4)
    if not cmd:
        break
    bf_program+=tobf_dict[cmd]
bf(bf_program)
# In fact, it's just a Brainfuck interpreter with another layer of "啊!" scripts.

Categories