Interlude
Interlude is an esolang by User:PythonshellDebugwindow.
Syntax
Interlude programs are two-dimensional. Each program is divided into acts, which are like programs in themselves. Acts are separated by pipes (|
), which form vertical lines called interludes. Acts are rectangular.
This means that the program
AAA|BB|CCCC AAA|BB|CCCC AAA|BB|CCCC
consists of three acts, each one consisting of 9 A
s, 6 B
s, and 12 C
s respectively.
At least two acts must be entered over the course of a program.
Execution
The program starts executing at the top-left character of the first act. Acts are executed from left to right, then top to bottom.
For example, the act
ABC DEF GHI
would be executed in alphabetical order.
If the bottom-right character of an act is reached, then the program is exited; if less than two acts have been entered during the program, then an error is thrown.
Memory
Interlude uses a queue. Dequeuing from an empty queue returns zero.
Commands
Command | Effect |
---|---|
v |
Move the IP down a line; if the IP is on the last line, then quit the program |
$ |
Dequeue an integer n and go to the top-left character of the one-indexed nth act |
+ |
Dequeue an integer n; if n is greater than zero, then dequeue n more integers and enqueue their sum, otherwise dequeue an integer and print its ASCII value |
* |
If the next character is a digit 0-9, enqueue it; if it is alphabetic, enqueue its ASCII value; if the next character c is a minus sign, then enqueue the result of subtracting *c from zero (if the character after the minus sign is not alphanumeric, then dequeue an element as normal, but enqueue zero); otherwise, dequeue an element and discard it
|
? |
If the next character is a period, input a character and enqueue its ASCII value; if the next character is a command listed in this table, skip it if the element that would be dequeued from the queue next is nonzero (but don't dequeue the element); otherwise, empty the queue |
: |
Throw an error and quit the program (can be used as padding if it will never be executed) |
The commands *
and ?
will skip their following character, if there is one (*
can skip two characters in some cases, and ?
can skip an entire *
or ?
command; see #Truth-machine for an example of the latter behaviour). All alphanumeric characters print themselves. Spaces (ASCII 32) cannot appear in a program. All other characters will push 78 to the stack, cause the IP to move to a random act, and change the character directly below the IP (if there is one) to v
in that order.
Examples
Hello, world!
Hello*9*9*9*9*8*5+*0+*9*9*9*5*4+*0+world*9*9*9*6*4+*0+*2$|v
Cat program
?.?v*2$|v *0+*1$:|v
Truth-machine
?.*-A*9*8*4+?*1$|1*1$|v 0*2$::::::::::::|::::|v
Note that the second ?
can skip the entire *1
after it. Note also the extensive use of :
as padding.
Dice roll
&|1|2|3|4|5|6
Outputs a random number from 1 to 6. &
is used to jump to a random act, since it is not a command.