Benul

From Esolang
Jump to navigation Jump to search

Benul is an esoteric programming language created by user:David.werecat where the source code is only BEL and NUL characters.

Instructions

All Benul programs are required to have a pleasing sound when displayed on a terminal. The bit queue begins empty with the current value set to 0. Each run of BEL or NUL characters is interpreted as an instruction. If a run exceeds five consecutive characters, it is broken up into multiple runs starting at length five until the end of the run. Runs are not broken by characters other than BEL and NUL, since unrecognizable characters are not interpreted. However, it is not recommended to use other characters. Console IO is performed bitwise, but is buffered per byte. Each byte is read/written from MSB to LSB. The program runs in a loop and requires special conditions to terminate (see below).

Run Description
1 NUL NOP.
2 NULs Enqueue the current value in the queue and set the current value to the value dequeued from the queue afterwards.
3 NULs Flip the current value.
4 NULs If the current value is 0, skip ahead to the next 4NUL. If there is no next 4NUL, end the program.
5 NULs Set the current value to 0.
1 BEL NOP.
2 BELs Read a bit from STDIN to the current value.
3 BELs Write the current value to STDOUT.
4 BELs Enqueue a new 0 in the queue (expand queue size).
5 BELs Set the current value to 1.

Examples

The following are hex dumps of the programs (for better visibility).

Terminating Program

00 00 00 00

CAT Program

07 07 00 07 07 07

Truth Machine

00 00 00 07 00 00 00 00 07 07 07 07 00 07 07 00
07 07 00 07 07 00 07 07 00 07 07 00 07 07 00 07
07 00 07 07 00 00 07 00 00 00 07 00 00 00 00 07
00 00 00 00 00 07 07 07 00 07 07 07 00 00 00 07
07 07 00 07 07 07 00 00 00 07 07 07 00 07 07 07
00 07 07 07 00 00 07 07 07 00 00 00 00 07 00 00
07 00 00 00

Hello, world!

00 07 07 07 00 00 00 07 07 07 00 00 00 07 07 07
00 07 07 07 00 00 00 07 07 07 00 00 00 07 07 07
00 07 07 07 00 07 07 07 00 07 07 07 00 00 00 07
07 07 00 07 07 07 00 00 00 07 07 07 00 07 07 07
00 00 00 07 07 07 00 00 00 07 07 07 00 00 00 07
07 07 00 00 00 07 07 07 00 00 00 07 07 07 00 07
07 07 00 00 00 07 07 07 00 00 00 07 07 07 00 07
07 07 00 00 00 07 07 07 00 07 07 07 00 07 07 07
00 00 00 07 07 07 00 07 07 07 00 00 00 07 07 07
00 00 00 07 07 07 00 07 07 07 00 00 00 07 07 07
00 07 07 07 00 07 07 07 00 00 00 07 07 07 00 07
07 07 00 00 00 07 07 07 00 00 00 07 07 07 00 07
07 07 00 07 07 07 00 07 07 07 00 00 00 07 07 07
00 07 07 07 00 00 00 07 07 07 00 00 00 07 07 07
00 00 00 07 07 07 00 07 07 07 00 00 00 07 07 07
00 07 07 07 00 07 07 07 00 07 07 07 00 00 00 07
07 07 00 00 00 07 07 07 00 07 07 07 00 07 07 07
00 07 07 07 00 07 07 07 00 07 07 07 00 00 00 07
07 07 00 07 07 07 00 07 07 07 00 00 00 07 07 07
00 00 00 07 07 07 00 07 07 07 00 07 07 07 00 00
00 07 07 07 00 00 00 07 07 07 00 07 07 07 00 00
00 07 07 07 00 00 00 07 07 07 00 07 07 07 00 07
07 07 00 07 07 07 00 00 00 07 07 07 00 00 00 07
07 07 00 07 07 07 00 07 07 07 00 00 00 07 07 07
00 07 07 07 00 00 00 07 07 07 00 00 00 07 07 07
00 07 07 07 00 00 00 07 07 07 00 07 07 07 00 00
00 07 07 07 00 00 00 07 07 07 00 07 07 07 00 00
00 07 07 07 00 07 07 07 00 07 07 07 00 00 00 07
07 07 00 07 07 07 00 00 00 07 07 07 00 07 07 07
00 00 00 07 07 07 00 00 00 07 07 07 00 07 07 07
00 07 07 07 00 07 07 07 00 00 00 07 07 07 00 00
00 07 07 07 00 07 07 07 00 07 07 07 00 07 07 07
00 00 00 07 07 07 00 00 00 07 00 00 00 00


External resources