1L

From Esolang

Jump to: navigation, search

Though Gregor Richards purported 2L as a Turing-complete language with only two operators, the nop operator (that is, anything that's not + or *) is so significant in 2L that it serves as a third. 1L is a family of attempts to reduce the set of symbols even further, producing a two-dimensional language that truly only has two symbols (the name being a perverted joke against 2L: since 2L has 3 commands, 1L has 2 commands).

Contents

[edit] 1L_a

1L_a, designed by Catatonic Porpoise, is the first 1L 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.

[edit] 1L_a105

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.

[edit] Angle-of-Incidence 1L

Angle-of-Incidence 1L (not a final name) is proposed by Gregor Richards as another way of reducing 2L to one instruction, while maintaining more of the visual feel of 2L.

The only symbols are nop and +, and + serves as both the turn and the operator. To accomplish this, the IP interacts with the + Black Box style, and the angle of incidence determines the command executed. Therefore,

   +
>>\
  v

would be different from

  ^
>>/
   +


[edit] 1L_AOI

1L_AOI was designed by Tslil Clingman in early 2008, who drew great inspiration from the base already laid down by Gregor Richards for Angle of Incidence 1L.

In 1l_AOI there is only one symbol: the + (plus) sign.

The language consists of otherwise similar components to the other 1l_x languages. There is a Command Pointer (CP) which moves through space, initially placed on the second line from the top, in left-hand corner of the programme, headed moves East. There is also Instruction Pointer (IP) which moves along a tape, one cell at a time, within which each can store up to a Byte (0..255). The IP is defaulted to Cell #3.

As the Command Pointer moves through space, it will encounter + signs, the effect of which are totally dependent on whether the Command Pointer passes through, or passes by and if so, on which side.


If the Command Pointer passes through a + sign then the following is evaluated:

Direction Effect
Down Move IP Right
Up Move IP Left
Left Decrease IP Cell by one
Right Increase IP Cell by one


If the Command Pointer passes by a + sign, the effect is determined as such:

If the Instruction Pointer cell is non-zero, the Command Pointer will turn away from the +, otherwise, proceed straight.   
(The + sign must be diagonally opposite the point at which the CP is required to turn.)                                                                                   

Example: if the Instruction Pointer cell is non-zero and the following is reached:

>___ +

the effect would be:

>___ +
    |	
    |


The following turns are valid:

>_______ +      + _____ +
<_______|   >____|     |______>
        +         +   +


Be wary of reflections, they will most likely be trouble, the following is an example:

>____ +  This will cause the the Command Pointer to deflect ambiguously, but twice
      +  and thus reflect itself 180 degrees.

NOTE: In the above examples, the placement of the + sign is incorrect, but was purposeful to ease demonstration. In order for a turn to occur, the + sign needs to be diagonally opposite the corner/turning point.


I/O is the same as 2L:

"The two leftmost tape locations, called TL0 (Tape Location 0) and TL1 (Tape Location 1)
respectively, are significant. TL1 doesn't actually hold a value, it merely causes an I/O
operation if you attempt to increment or decrement it. If the value at TL0 is 0, and you
attempt to change the value of TL1, a character will be read from input into TL0. If TL0
is not 0, and you attempt to change the value of TL1, a character will be outputted from
the value of TL0."


However, in 1l_AOI, TL1 always has a non-zero value, which allows for a conditional turn to occur when the Instruction Pointer is pointing to it.


Example: Output "1"

  + +                                                    +
+      +++++++++++++++++++++++++++++++++++++++++++++++++   
     +                                                  
     +                                                  +  
                                                           +
+     +                                                +

[edit] See also

[edit] External resources

Retrieved from "http://esolangs.org/wiki/1L"
Personal tools