ABCR
Jump to navigation
Jump to search
ABCR is a queue-based programming language created by Steven Hewitt.[1] It uses three FIFO queues known as A, B, and C that store unbounded integer values, as well as a single register R that stores the result of the last operation. Most of the commands have a different symbol for each of the three queues, and each queue serves a slightly different function.
Commands
Commands that do not have a register-variant (R-variant) | ||||
---|---|---|---|---|
A-variant | B-variant | C-variant | R-variant | Description |
a |
b |
c |
Dequeues a single value into R from the given queue. | |
A |
B |
C |
Enqueues a single value from R into the given queue. | |
1 |
2 |
3 |
Peeks, or copies the front of, the given queue into R. | |
! |
@ |
# |
Sets R to the length of the given queue. | |
* |
+ |
, |
Dequeues a single value, adding it to R's current value. | |
- |
. |
/ |
Dequeues a single value, subtracting it from R's current value. | |
o |
p |
q |
Peeks at the front of the queue to print it as a number. | |
O |
P |
Q |
Peeks at the front of the queue to print it as a character. | |
Commands that have an R-variant | ||||
4 |
5 |
6 |
7 |
Loop start; jumps in front of the matching mark if the front of the queue (or, in the case of R, the register value) is zero. |
x |
x |
x |
x |
A mark; unconditionally leaps back to execute its matching loop start. |
( |
Decrements the register value by 1. | |||
) |
Increments the register value by 1. | |||
i |
Accepts a signed number from input. |
Queue defaults
When an empty queue is peeked or popped, its behavior will differ based on which queue it is:
- A defaults to
0
for both popping and peeking. - B defaults to
1
for both popping and peeking. - C defaults to grabbing the character code of the next input character (the rest of which, of course, are queued if more than one input character is given) if popped, or to the current register value if peeked.
Popping from an empty C-queue is the only way to input characters.
Examples
Hello, world!
))))))))))AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA (((((BBBBBBBBB ******+))C ***(C +))C C )))C -------..)C ********+))C .(((C )))C .(C .(((C ------.((C aC6Qcx
Output:
Hello world!
Cat program
cC6QcCx
Truth-machine
iA4oxo