Dotlang

From Esolang
Jump to navigation Jump to search
The title of this article may well be dotlang, due to typically being lowercased except, often, at the start of a sentence.

Dotlang is a two-dimensional esoteric programming language created by User:Andrew3335. It was inspired by AsciiDots, hence its name "dotlang".

Language overview

Concept

You must start with one initial instruction pointer (the initial "dot"), which you must specify the position of by putting a (bullet point) at that position. You can also determine its initial direction by putting ^, v, < or > in the cell to the left of it. If not specified, the initial direction is right by default. Then, you can add as many as you wish by using the commands ( and ) (more on parentheses in the next section).

You can move dots up, down, left and right by using the same commands that are used for determining its initial direction. If a dot moves onto a blank space, it stops existing (unless you only type a space and nothing else, but this is more of an exception).

Dots can have values in the form of a number. A dot's value can be set and output by using ~ and # (again, more on this in the next section).

Warps teleport dots to a different location in the code. The main command for warps is W (and yep, you guessed it, more on this in the next section).

Commands

and ^v<> have already been explained.

#number sets a dot's value to a number number, e.g. #32.0 sets a dot's value to 32.0 (this can either be an integer or a floating point number).

#`string` sets a dot's value to a string string, e.g. #`Hello, world!` sets a dot's value to "Hello, world!".

~ sets a dot's value to the user's input.

# outputs a dot's value. If the dot in question has no value, the program will halt.

Parentheses (parens) can have names. For example, (`seven is an open paren named seven. Open parens create another dot at its matching closing paren, i.e. a closing paren with the same name as the open paren. For example, if a dot moves to (`seven, another dot will be created at )`seven. If no such closing paren exists, the program will halt. Parens don't have a default name; if you don't specify a name, they just don't have one.

Warps have a starting point (`s) and an exit point (`e). Dots are teleported from the starting point to the exit point. Like parens, warps can have names. For example, Wseven`s is the starting point of a warp named seven. The starting point of a warp teleports a dot to its matching exit point, i.e. an exit point with the same name as the starting point. For example, if a dot moves to Wseven`s, it will be teleported to Wseven`e. If no such exit point exists, the program will halt. Warps don't have a default name; if you don't specify a name, they just don't have one.

W~ teleports a dot to the starting point of a warp with a name of the user's input, meaning that an exit point is optional when using W~. For example, if the user inputs seven, the dot will move to Wseven`s. If no such starting point exists, the program will halt.

Control Flow Commands

Note: The corresponding vertical direction for right is up, for left it's down. The corresponding horizontal direction for up is right, for down it's left.

Command Description
! Checks if a dot's value is a string; if not, the dot continues in the same direction; if it is, the dot is ejected in its corresponding vertical/horizontal direction
? Does the same for floats
: Does the same for ints

Examples

Hello, world!

•#`Hello, world!`#

Quine

This is the only time that the number of initial dots does not have to be 1. Fun fact: The creator added this feature just to make a quine possible.

 

It's just a space, if you were wondering.

Cat program

•>~v
 ^#<

Truth-machine

•W~

W0`s#0#
W1`s#1>#<

Explanation: First, the dot is teleported to W{input}`s. If the user inputs 0, the dot ends up at W0`s, where its value is set to 0 and is then output once. If the user inputs 1, the dot ends up at W1`s, where its value is set to 1 and is then output indefinitely. If the user inputs anything else, the program halts without outputting anything.

Computational class

The creator believes that dotlang is Turing-complete, although it has not been proven yet.

Implementations

A Python interpreter by User:Bangyen.

See Also

This language was inspired by: