Hurgusburgus

From Esolang
Jump to navigation Jump to search

Hurgusburgus is a programming language by User:BradensEsolangs, intended to be very confusing.

The basics of Hurgusburgus

Hurgusburgus is based on a deque. A program starts with one deque, the hurgusdeque. A deque in Hurgusburgus can store 8-bit unsigned integers, Hurgusburgus code (which is used for flow control and cannot be altered), and sub-deques.
Deques 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 deque. When a program reaches the end, it goes back to the start.
When you input the program into an interpreter, it should be assigned to the hurgusdeque.
Note: I once referred to deques as queues, in this article, and injecting as enqueuing.

Instructions

Injecting

These are executed as one instruction, as stuff in a pair of brackets, no matter how long.
(): Injects the integer inside it.
{}: Injects the code inside.
[]: Injects a deque 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.

Deque operators

$: Pops and discards the frontmost value.
:: Injects the frontmost value, without popping it.
r: Pops an integer (which we will call n) and rotates the n frontmost remaining values clockwise, like a stack.
l: Like the r instruction but counter-clockwise.
R: Like r, but rotates the entire deque. Unlike its lowercase counterpart (Hurgusburgus is case sensitive), it doesn't pop 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 >: Pops an integer, respectively left or right shift it by one, and inject it.
& | and ^: Pops two integers, respectively AND, OR, and XOR them, and inject the result.

Control flow

?: Pop an integer. If it is nonzero, execute the next instruction.
;: Pretty much the most complicated instruction. Starts at the deque the program is assigned to. If the frontmost value is code, pop it, replace the current program with that code, and start executing the code. But if it's a subdeque, do not pop it, but recurse in that subdeque.
#: Like ;, but instead of code, requests a deque that only has integers, which is converted to ASCII (first character is frontmost).
p: Injects the code currently being executed.
n: Like p, but instead injects a queue of integers, that can be used with #.
x: Does nothing. For sync.
@: Ends the program running.

Transfer

u: If the program is assigned to a subdeque, pop a value and inject it onto the deque that it is a subdeque of. If the hurgusdeque executes this, it is the same as $.
v: Pop a value. If the frontmost value after popping is a deque, inject the popped value into that deque.

I/O

i: Get an ASCII character and inject it as its character code.
o: Pop 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@