Yes/No

From Esolang
Jump to navigation Jump to search

Yes/No is a minimalistic esolang made by User:Intiha where every program consists solely of the words Yes and No. Programs are sequences of these words, and their meaning is derived from binary patterns.

Basics

  • Yes = 1
  • No = 0

A program is interpreted as a stream of bits (Yes → 1, No → 0), and instructions are defined by fixed-length patterns of bits.

Instructions

  • Yes Yes → Increment accumulator
  • Yes No → Output accumulator as ASCII
  • No Yes → Jump to instruction index
  • No No → End program

Notes

  • Accumulator: a single integer value used for computation and output.
  • Instruction pointer (IP): moves in steps of 2 bits.
  • Yes/No Uses streaming as you can see in the Python interpreter section
  • Yes/No's 99 Bottles of Beer is around 8,205,985 characters (8.2 MB; credits to AadenBoy for fixing this and converting from 7.82 MiB).

Program Structure

  • A program is just a sequence of Yes and No.
  • The interpreter reads 2 “words” at a time (2-bit instructions).
  • Execution stops when the `No No` instruction is reached or the program ends.

Example Program

Yes Yes Yes No No No
  • Step 1: `Yes Yes` → Increment accumulator (acc = 1)
  • Step 2: `Yes No` → Output accumulator (prints ASCII `\x01`)
  • Step 3: `No No` → End program

Python Interpreter

import sys

def yesno_interpreter(program_path):
    acc = 0
    with open(program_path, "r") as f:
        ip = 0
        buffer = f.read().split()  # streaming word by word
        length = len(buffer)

        while ip + 1 < length:
            w1, w2 = buffer[ip], buffer[ip+1]
            instr = ('1' if w1 == 'Yes' else '0') + ('1' if w2 == 'Yes' else '0')

            if instr == '11':       # Yes Yes → Increment
                acc += 1
            elif instr == '10':     # Yes No → Output
                print(chr(acc), end='')
                acc = 0
            elif instr == '01':     # No Yes → Jump (unused)
                pass
            elif instr == '00':     # No No → End
                break

            ip += 2

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python yesno_cli.py <program.yesno>")
        sys.exit(1)
    yesno_interpreter(sys.argv[1])

Text to Yes/No

def text_to_yesno(text, filename="output.yesno"):
    output = []
    for ch in text:
        val = ord(ch)
        output.extend(["Yes Yes"] * val)
        output.append("Yes No")  # print char
    output.append("No No")  # end program

    with open(filename, "w") as f:
        f.write(" ".join(output))

# Example usage
text_to_yesno("Hello, World!")

99 bottles of beer

Link for it

Future

  • Yes/No To Native! (will take 1 mb+)
  • Yes/No ^ 2 (4 more commands)