LAIN

From Esolang
Jump to navigation Jump to search

LAIN is a esoteric language developed by User:Valtsu0 as his first language. It was designed to be a self modifying language that lacks if statements. The name LAIN is not an acronym and is only capitalized to indicate that the name is supposed to be yelled out loud.

Syntax

Any line that doesn't include a semicolon is printed. For example:

example

will print example

Anything after a semicolon is a comment.

Variables

LAIN is a dynamically typed language, that has two data type. They are integers and strings. Variable names cannot include a ; or a ".

string = "String";
integer = 3;
var = string;

An operation can be performed during variable assignation, but only one can be performed at a time. This is the only time operators can be used. Operators are +, -, min and max. Operator must be between two values or variables. The + will perform integer addition when both values next to it can be interpreted as integers. Otherwise it will perform string concatenation. Rest of the operators can only be used on integers.

integer = 5 max integer;
string = 4 + "String";

The variable # is always the line number of the next line.

Input

Input is taken with a variable followed by a semicolon

input;
var;

Goto

goto is followed by a integer or string. Line indexing starts at 0 for all purposes. If given a string the destinations will be a label corresponding to that string and if no such label currently exists the destination will be the next line. A label is created by starting a line with :.

goto integer;
goto 0;
goto "label";
:label;

Line

line command changes the specified line to the specified string.

line integer string;
line 3 "Hello, world!";

Code examples

Truth-machine

var;
var = var + 3;
goto var;
goto 6;
1
goto 4;
0

99 Bottles of beer on the wall

first = " bottles of beer on the wall,";
second = " bottles of beer.";
fourth = " bottles of beer on the wall.";
beer = 99;
lyric = beer + first;
line 6 lyric;

lyric = beer + second;
line 9 lyric;

Take one down, pass it around,
beer = beer - 1;
lyric = beer + fourth;
line 14 lyric;


var = beer min 2;
var = var + 18;
goto var;
goto 21;
goto 4;
1 bottle of beer on the wall,
1 bottle of beer.
Take one down, pass it around,
No bottles of beer on the wall.

External resources