Hurgusburgus

From Esolang
Jump to: navigation, search

Hurgusburgus is a programming language by Braden, to be very confusing.

The basics of Hurgusburgus

Hurgusburgus is based on a queue. A program starts with one queue, the hurgusqueue. A queue in Hurgusburgus can store 8-bit unsigned integers, Hurgusburgus code (which is used for flow control and cannot be altered), and sub-queues.
Queues can be given programs. Hurgusburgus is a concurrent programming language, that means when multiple programs are ran, instead of one program at a time, multiple programs are ran at the same time.
In Hurgusburgus, each program is ran, in order of creation, one instruction at a time. Each program operates on its own queue.
When you input the program into an interpreter, it should be assigned to the hurgusqueue.

Instructions

Enqueuing

These are executed as one instruction, as stuff in a pair of brackets, no matter how long.
(): Enqueues the integer inside it.
{}: Enqueues the code inside.
[]: Enqueues a queue inside it. It can be blank, and can only contain integers. Starts with the frontmost value, and goes back. Can be separated with spaces or commas.

Queue operators

$: Dequeues and discards the frontmost value.
:: Enqueues the frontmost value, without dequeuing it.
r: Dequeues an integer (which we will call n) and rotates the n frontmost remaining values clockwise, like a stack, where the topmost elements are the frontmost on the queue.
l: Like the r instruction but counter-clockwise.
R: Rotates the entire queue clockwise. Unlike its lowercase counterpart (Hurgusburgus is case sensitive), it doesn't dequeue anything. Analogous to :$ (I think, tell me if I made a mistake)
L: Like the R instruction but counter-clockwise.

Binary operators

These operators add extra mind-screwery, by being very elementary binary ops.
< and >: Dequeue an integer, respectively left or right shift it by one, and enqueue it.
& | and ^: Dequeue two integers, respectively AND, OR, and XOR them, and enqueue the result.

Control flow

?: Dequeue an integer. If it is nonzero, execute the next instruction.
;: Pretty much the most complicated instruction. Start at the queue the program is assigned to. If the frontmost value is code, dequeue it, and replace the current program with that code, and start executing the code. But if it's a subqueue, do not dequeue it, but recursively run this command as if that subqueue were executing it.
#: Like ;, but instead of code, requests a queue. This queue has only integers in it, and to execute it, it is converted to ASCII, and starts with the frontmost integer.
p: Enqueue the code currently being executed.
n: Like p, but instead enqueues a queue of integers, that can be used with #.
x: Does nothing. For sync.
@: Ends the program running. If the program reaches its last instruction, it starts over, at the first instruction.

Transfer

u: If the program is assigned to a subqueue, dequeue a value and enqueue it onto the queue it is a subqueue of. If the hurgusqueue executes this, it is the same as $.
v: Dequeue a value. If the frontmost value after dequeuing is a queue, enqueue the dequeued value onto that queue.

I/O

i: Get an ASCII character and enqueue it as its character code.
o: Dequeue an integer (mod 128) and print it as ASCII.

An example: a truth machine

Pretty sure I got this program right, prints and halts if it takes a LITERAL ZERO:

i(48)^:?{(1)o}?;(0)o@