From Esolang
Jump to: navigation, search

1L_a, designed by Scott Feeney, is an esoteric programming language and the first member of the 1L family to have been implemented.

The memory is an array of bits (a tape), unbounded on the right. The leftmost cell is called TL0, and the next couple cells are called TL1 and TL2. The data pointer starts out pointing to TL2. The instruction pointer starts at the upper left corner of the source file moving down, and the program ends when the IP travels off the top or left side of the code. (Travelling off the right or the bottom results in undefined behavior.) The IP moves one cell at a time in the current direction, be that up, down, left, or right.

There are two symbols: spaces and everything else.

A space, if encountered by the IP moving left, moves the data pointer one cell to the left and then flips the bit at the data pointer. If a space is encountered by the IP moving up, the data pointer is moved one cell to the right. A space encountered while moving down or right is a nop.

Everything else forms a "turning wall" like the + in 2L. The instruction pointer moves backwards one space, then turns 90 degrees left if the current bit is 0 or right if the current bit is 1.

As in 2L, I/O is memory-mapped. Flipping the bit at TL0 causes an input or output operation, as follows:

If TL1 and TL2, then a 1 bit is output.
If TL1 and not TL2, then a 0 bit is output.
If not TL1, then a bit is input and saved in TL2.

The programmer should expect that asking for a bit of input will read and buffer a full byte from standard input and that no output will be done until 8 bits have been output, at which point a byte will be written. I/O is most significant bit first; e.g., to output an ASCII A (65, binary 01000001), one would output a 0, a 1, five 0's, and a 1.

1L_a is expected to be Turing-complete, but this has not been proven.


The 1L_a105 standard, published by the "1L_a Standardization Committee", subtly generalizes the language. It leaves implementation-defined how source code is represented on disk, saying only that the code is a 2D array of symbols. The symbol found in the top left corner of the array represents the GO instruction, while all other symbols in the alphabet represent the STOP instruction. The GO instruction works like the space, and the STOP like the turning wall, of pre-standard 1L_a.

In addition to letting the programmer use whatever characters he or she wants, this change also allows 1L_a to be programmed as a graphical language, using the color of a pixel as a symbol. An implementation exists that supports both text and graphical source code.

Here is a program to print "A" in 1L_a, presented as graphical source code. Note that red is the GO instruction here, while white and black are both the STOP instruction. In this case, the distinction is made to help document the code: the instruction pointer only touches red and black pixels.

Enlarged view

Program to print "A" in 1L_a, as graphical source code.

Actual size

Program to print "A" in 1L_a, as graphical source code.

See also

External resources