line

From Esolang
Jump to navigation Jump to search
Line
Designed by Relt
Appeared in 2021
Memory system Cell based
Dimensions Two dimensional
Computational class Turing complete
Reference implementation Unimplemented
File extension(s) currently none

Line is a 2d cell-based programming language that is structured on lines and turns.

Syntax

Program flow

A line is a path that the Cursor follows every step 1 grid unit forward.

1 2 3 4 5
Lineanim1.png Lineanim1.1.png Lineanim1.2.png Lineanim1.3.png Lineanim2.png

The cursor will turn along with the line

1 2 3 4
Lineanim3.1.png Lineanim3.2.png Lineanim3.3.png Lineanim3.4.png

The cursor will merge into another line with this type of intersection

Lineanim11.1.png Lineanim11.2.png

Both of these situations will end up with the cursor moving up

Instructions

Tape operations

The cursor has its own memory tape (like in Brainfuck)

+ and - equivalents are

Lineanim4.png going through this diagonal line will increment the selected cell
Lineanim5.png and going through this diagonal line with decrement it

The cursor detects what type of curve its going through, and will act accordingly

These instructions work in every 4 directions, meaning that all of these:

Lineanim4.png Lineanim4.1.png Lineanim4.2.png Lineanim4.3.png

will increment the selected cell

Both instructions can run multiple times in a row like this:

Lineanim6.png Every step, the current cell will get incremented. The brainfuck equivalent of this is +++


Moving along the tape can be done with these curves

>
Lineanim7.png When the cursor detects that it has gone through a curve like this, it will move the pointer to the right
<
Lineanim8.png When the cursor detects that it has gone through a curve like this, it will move the pointer to the left

Conditional turn

Lineanim9.png When the cursor encounters this type of curve, it will turn right if the current cell is 0, otherwise, it will turn left.

User input

Lineanim10.png When the cursor encounters this type of curve, it will ask the user for a number
Lineanim11.png When the cursor encounters this type of curve, it will print the current cell as a number

Brainfuck compatibility

While this language is 100% brainfuck compatible, it also offers features that come from the way its structured, like making unconditional jumps to other parts of the code.


Example programs

Addition Lineanim13.png

Multiplication Lineanim14.png