We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Qadi

From Esolang
Jump to navigation Jump to search

Introduction

Qadi (/qədi/) is a language made by User:Biscat111 in 2026 due to a perceived lack of queue based languages.

It is most likely turing complete, and the original creator is planning to write a brainfuck interpreter in Qadi.

Description

Qadi is a queue-based language with 7 instructions.

Command Description
. Adds a 0 to the end of the queue.
+ Increment the value on the front of the queue.
- Decrement the value on the front of the queue, the value is allowed to go negative.
r Copy the value on the front of the queue to the back of the queue, then pop the front value.
i Makes you input a number or a character, depending on if the following character in the code is a "c"
o Outputs a number or a character, depending on if the following character in the code is a "c"
s Always followed by a number N in the code. If the front value of the queue is not 0, jump to the Nth character.

Any other characters are noops.

Programs

Truth Machine:

ios1

Factorial:

i.....-r+r+r+r+r+rs6pr-r-rrrr-rr-r+rrrrs32prr..rrr-r+r+rrrrs50
prr-s30prrpp-r.....-rr+r+r+rrrs81p-rrrr+r+rs96prrr-s123+s128rrrs32rro

Interpreter

Python Interpreter, by Biscat111.

code = input("code: ")
codelist = []
#gets code into 1 (one) string
while code != "":
    #print(code)
    codelist.append(code)
    code = input("code: ")     
code = ""
while codelist != []:
    x = codelist[0]
    code += x
    codelist.remove(x)
    
#by Biscat111
code += " "
queue = []
cursor = 0
while cursor < len(code):
   
    if code[cursor] == ".":
        queue.append(0)
   
    if code[cursor] == "+":
        queue[0] += 1
   
    if code[cursor] == "-":
        queue[0] -= 1
   
    if code[cursor] == "p":
        queue.pop(0)
   
    if code[cursor] == "r":
        front = queue.pop(0)
        queue.append(front)
   
    if code[cursor] == "i":
        if code[cursor+1] == "c":
            queue.append(ord(input("input character: ")))
        else:
            queue.append(int(input("input number: ")))

    if code[cursor] == "o":
        if code[cursor+1] == "c":
            print(chr(queue[0]), end="", flush=True)
        else:
            print()
            print(queue[0])
   
    if code[cursor] == "s":
        if queue[0] != 0:
            cursor += 1
            adress = 0
            #is the character between 0 and 9
            while 47 < ord(code[cursor]) < 58:
                digit = int(code[cursor])
                cursor += 1
                adress *= 10
                adress += digit
            cursor = adress-1
            #other debugging tool
            #print(code[(cursor+1):])
            #print("s")
   
    #debugging tools
    #print(code[cursor])
    #print(queue)
    #print(cursor)
    #if cursor > 100:
    #    pass #debugging
    cursor += 1