Save this program under the name
! and execute it.
_ [0,0,0]• create bee
8 [0,0,8]• lstack 1st=8
F [8,8,8]• all lstack=lstack 1st
+++ [8,8,16]• 1st=1st+2nd
[8,8,24]• 3 times
P [8,8,33]• increment 1st
] [8,8,2377900603251621888]• rotate bits of 1st by 2nd steps
f • push lstack 1st ont gstack
1 [8,8,1]• lstack 1st=1
F [1,1,1]• all lstack=lstack 1st
w write gstack to file. lstack 1st=bytes used for file name, lstack 2nd= used file content bytes.
If we look at the stack contents in hex, it gets clearer what’s happening:
lstack[0x0000000000000008,0x000000000000008,0x0000000000000021]• in hex.
If we rotate the bits of the 1st lstack value by 8 to the right, we get
lstack[8,8,2377900603251621888]•, which is
lstack[0x0000000000000008,0x000000000000008,0x2100000000000000]• in hex.
f pushes the 1st lstack value on the gstack:
Now comes instruction w:
First, the 4-byte words of the gstack get reinterpreted as a stack of UInt8 values:
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x21]•, in little endian order. The MSB is on top of the stack.
w takes the 1st lstack value as number of bytes taken for the file name, and the 2nd lstack value gives the number of bytes stored in the file.
lstack[1,1,1]• means that 1 byte is taken as file name.
0x21 is the ASCII code for
!, which is the name of the program itself. The next single byte (lstack 2nd), the value
0x00 is stored as file content, which is not executable as beeswax program.