HBL

From Esolang
Jump to navigation Jump to search

Halting Binary Logic

HBL can also refer to Half-byte lisp.

HBL is a theoretical esoteric language that uses whether or not a subprogram halts to represent memory, A halting program is a 0, an unhalting program is a 1. HBL’s memory structure is a random access ‘tape’, and each ‘bit’ stores a single program. The tape can contain infinitely many values, similar to a Turing machine. HBL is believed to be Turing complete, and thus can simulate any other language.


Basic Instructions:

  • [ is the start of a loop, HBL loops are infinite with the only exit being break conditions.
  • ] is the end of a loop, like pretty much all languages, loops can be nested.
  • ! is the set command, and takes one argument: a program, ended by a ). it writes the program it is given to the currently selected cell.
  • ? is a conditional break, exits the current loop if the current cell is a ‘1’, otherwise does nothing.
  • ; is a simple break, exits the current loop no matter what.
  • > is the move right command, moves the pointer by +1
  • < is the move left command, moves the pointer by -1

With these instructions, most logic is possible, including addition, subtraction, and other logic. Most logic is easily done using rule tables, for example, a AND gate could be (I think):

 [[?>>![;]][?<![])]?[?>>![;]][?<![])]?![])]

All programs have their own pointer on the tape, preventing a control struggle from programs accessing the tape. Threading is also possible, by reserving spots on the tape for subprograms to run, however, status on programs would require secondary spots on the tape, to tell if the program has halted yet or not. An interesting paradox caused by the way the language works also exists, it is possible to make a program that halts if and only if it doesn't halt (theoretically, pointed out by ais523), an example being ![?])[?] . There is a high probability that there are multiple other paradoxical situations possible.

Boolfuck translation

Notice: due to the nature of this programming language, it is extremely difficult to prove this, and all you have is the word of this document.

+ = [[?![])>![])<;]>?<![;])>![;])]
> = >
< = <
[ = [[[?![])>![])<;]>?<![;])>![;])<;]? <amount of moves to return to original cell>[[?![])>![])<;]>?<![;])>![;])] <matching bracket>
] = ]

There are minor diffrences and quirks to iron out, but it is plenty possible to translate boolfuck, a Turing Complete language, to HBL, proving HBL turing complete.