From Esolang
Jump to navigation Jump to search

lhooq is a language created by user:Xifeng for describing systems like the Digicomp II toy computers. Programs take the form of relational tables, the representation of which is implementation-dependent. For the purpose of writing and discussing lhooq code, csv format is most convenient. The name of the language comes from the header that begins all csv-format lhooq programs, establishing the four fields 'l' (Line), 'h' (Head), oo (Other Option), and 'q' (Q value, from flip-flop terminology).

The Language

The operation of a lhooq program is more or less that of a one instruction set computer, similar to a TOGA computer but with more restrictions, and a strict separation between code and data. Each line of a lhooq program contains a label, two jump destinations, and a single bit of data. Execution begins with the line labeled "init," and consists of toggling a bit, then jumping to the first jump destination if that bit was 0 before toggling, and jumping to the second jump destination if that bit was 1 before toggling. Each bit in memory can only be associated with two possible destinations, and these cannot be changed by the program.

Registers can be defined by linking bits together in groups, and these registers can perform simple arithmetic, but their use is very limited. Since every bit of memory has to be declared ahead of time, it is clearly not Turing-complete, but it is not even obvious that it rises to the level of a linear bounded automaton: it is fairly simple to create a register that can count up or one that can count down, but it is not so easy to even create a register that can both increment and decrement.

Once the program halts, by jumping to a nonexistent line, all line-labels beginning with "out" are output, along with their associated bit value.


The implementation of lhooq being incomplete, this is only a hypothetical example, but it looks alright on paper. The program adds the contents of the 'dec' register to the contents of the 'out' register.