123

From Esolang
Jump to navigation Jump to search

123 is an esoteric programming language created by user:David.werecat which further minimizes asdf.

Instructions

The pointer begins at location 0. The program is executed in a loop, and only terminates if the end of the program is reached and the pointer is below 0. All bits start at the value FALSE. Any unrecognizable characters are treated as NOPs.

Instruction Description
1 Flip the current bit and move the pointer left. If the pointer ends at location -4, the pointer is moved to location 0.
2 If the pointer is at location -3, read a character from the console and put it in locations 0 through 7; then move the pointer to location 0. If the pointer is at location -2, write a character to the console corresponding to locations 0 through 7; then move the pointer to location 0. At any other location, move the pointer right.
3 Specifies a jump symbol. If the pointer is below 0, do nothing. If the current bit is TRUE, skip back to either the previous jump symbol or the start of the program. If the current bit is FALSE, skip forward to either the next jump symbol or the end of the program.

Examples

Cat Program

111212112

Hello World

222122221212112112112112112112112222122221212112112112112112122222211121121112112121122222221112112111211222222211121111211211222222211121111212222221112111121121122222221112111121222222111211111212112222222111211111222222111111222221111112222221111112222211111222222211211121111122222221121112111122222221112111112121122222221112111112222222111121121112112222222111121121122222211121111211211222222211121111212222221112112111211211222222211121121112122222112112112112111222222112112112112112

Breakdown:

 2221222212121121121121121121121122221222212121121121121121121 // H
 222222111211211121121211222222211121121112112                 // e
 2222221112111121121122222221112111121                         // l
 2222221112111121121122222221112111121                         // l
 2222221112111112121122222221112111112                         // o
 222221111112222211111122222211111122222111112                 //' '
 2222221121112111112222222112111211112                         // W
 2222221112111112121122222221112111112                         // o
 2222221111211211121122222221111211211                         // r
 2222221112111121121122222221112111121                         // l
 22222211121121112112112222222111211211121                     // d
 22222112112112112111222222112112112112112                     // !

Note : This assumes the characters are read in little-endian fashion. (Least significant bit on memory position 0 and most significant bit on position 7)

External resources