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.

BeeScript

From Esolang
Jump to navigation Jump to search

BeeScript is a stack-based esoteric programming language made by VilgotanL.

Instructions

AVIATE n Pushes the ASCII code of the nth character in this version of the bee movie script
BEE Duplicates the top value of the stack
BLACK Pops the top value of the stack and prints it as an ASCII character
BARRY Pops A and then B from the stack and pushes B - A to the stack
FLY n Pops the top of the stack, if it is non-zero this instruction jumps to the nth line (1-indexed)
ROTATE Removes the bottom value of the stack and pushes it to the top
ROTAT Pops the top of the stack and pushes it to the bottom
YELLOW Takes one character of input and pushes it's ASCII code to the stack

Any other instructions are ignored.

Examples

Cat program

The first program ever written in BeeScript.

YELLOW
BEE
BLACK
FLY 1

Hello World

AVIATE 389
BLACK
AVIATE 43
BLACK
AVIATE 14
BLACK
AVIATE 14
BLACK
AVIATE 3
BLACK
AVIATE 39
BLACK
AVIATE 9
BLACK
AVIATE 20
BLACK
AVIATE 3
BLACK
AVIATE 4
BLACK
AVIATE 14
BLACK
AVIATE 5
BLACK
AVIATE 324
BLACK
AVIATE 85
BLACK

Computational class

BeeScript can be easily proven to be Turing-complete by two methods: by using Minsky machine (only if elements are unbounded) and by using Stack automaton with "push bottom to the top" and "push top to the bottom" instructions that simulate a tape (regardless of the maximum size of an element)

Minsky machine

Minsky machine has this syntax, assuming it has Loose Circular Brainfuck-style tape of unbounded registers:

INC - increment current register
NEXT - switch to the next register
PREV - switch to the previous register
DEC - decrement current register
JNZ j - jump to j if register is not zero
JMP k - jump to k unconditionally

Program starts with:

AVIATE 1
BEE
BARRY

Followed by BEE repeated times the amount of registers minus one.

  • INC becomes:
AVIATE 2
AVIATE 6
BARRY
BARRY
  • NEXT becomes:
ROTAT
  • PREV becomes:
ROTATE
  • DEC becomes:
AVIATE 6
AVIATE 2
BARRY
BARRY
  • JNZ j becomes:
BEE
FLY j+off
  • JMP k becomes:
AVIATE 1
FLY k+off

off is an offset, it starts at 2+n where n is the number of registers, then for every instruction before the jump target add a specific integer:

  • For each INC and DEC 4 is added
  • For each NEXT and PREV 1 is added
  • For each JNZ and JMP 2 is added

Implementations

An interpreter in python written by the creator

See also