LINR

From Esolang
Jump to: navigation, search

Summary

LINR is an interpreted language invented by Sam Lord in March 2017. The name alludes to the unconventional order in which the written code may be run.

Operations

LINR has five operations.

Operation Arguments Summary
ADD [val/var] [val/var] [var] Adds the left value or variable to the right value or variable and stores the result in the final variable
SUB [val/var] [val/var] [var] Subtracts the right value or variable from the left value or variable and stores the result in the final variable
MUL [val/var] [val/var] [var] Multiplies the left value or variable and the right value or variable and stores the result in the final variable
DIV [val/var] [val/var] [var] Divides the left value or variable by the right value or variable and stores the result in the final variable
NUL [Anything] NUL acts as a comment. Anything can be included in its arguments and it's ignored at runtime. It is, however, included in the instruction count.

Execution order

The order of execution of LINR programs is dependant on the modulus 8 of the number of operations. Starting from line 0 the program is stepped through skipping [linecount]%8 lines. Then, the starting point of the program is increased to 1 and so on. The program completes when all operations have been run. No operation is completed twice. It is worth noting that only the second section of the code, containing the operations themselves, are taken into account when determining the line skip value.

Example code

The code of LINR is split into two sections separated by an @ symbol. The first half is variable declaration and the second are the operations. Operations may only be performed on float-like values and variables.

 ;
 a;
 b;
 c;
 d;
 e;
 @
 ADD 1 0 a;
 ADD 2 0 b;
 ADD 3 0 c;
 ADD a b e;
 ADD c e e;
 MUL c b d;
 DIV e 2.43 e;
 SUB e 6.78 e;
 NUL Literally anything can go here, probably;

The above code will set ; to be the operation separator, a-e as variables and then all instructions after the @ sign are executed in order. If the final NUL Literally anything can go here, probably; instruction is removed, the program will hang due to the [linecount]%8 being equal to 0 therefore only allowing the first operation to execute.

The above code completes with the variables containing the following a:1, b:2, c:3, d:6, e:-4.310864

Each instruction needn't be on a new line, however it is presented here as such to make it more readable.

Interpreters

As of the time of writing, only one interpreter exists for LINR and it's called LINR. See Resources.

External resources

  • LINR interpreter called, somewhat inventively, LINR. It's written in C# and offers some crude debugging features.
  • Creator, Sam Lord