The Goblins Operation

From Esolang
(Redirected from Goblins)
Jump to navigation Jump to search

The Goblins Operation is an modified goto operation that enables subroutine like behaviors. The operation was created for Blood32 by User:PixelatedStarfish and it is named after the hemoglobin in blood. The operation is a goto statement that goes to the instruction immediately after the last executed goto statement. This allows for a block of statements to be run at multiple points in execution, as if calling a subroutine or a macro. As the name suggests, this mischievous operation can have unpredictable side effects if a block starts running at an unintended time.

Goblins Operation Example in Blood32

In this example, the operation is indicated by G() at the end of a block.

[0,0]
T: 1000001
{
<ascii value A, decimal 65, hex 41>
G(3)
G(1)
G(2)
G(3)
E()
<note that if the exit operation is removed, Label 1 is executed, then Label 3, in a loop>
<block one>
L(1)
C()
G()
<block two>
L(2)
N()
G()
<block three>
L(3)
H()
G()
}
<
Note that block 3 is run twice, at the beginning and end of the program. 
Without the goblins operation, this would require two nearly identical blocks
that are distinguished only by labels and goto operations.
The expected output is as follows:
41
A
65
41
>