Laiyes

From Esolang
Jump to navigation Jump to search
Laiyes
Designed by User:Bil-joodusstudios
Appeared in 2021
Computational class Turing complete
Major implementations Laiyes rev 1.2
File extension(s) .txt

Laiyes is an esoteric programming language based around the idea of doing operation to a value just by typing them rather than first declaring to what variable. It also makes use of mostly single character commands to make programs shorter.

Overview

Laiyes makes use of one value which most instructions modify called the working value. All code is written on one line, but multiple lines can be used to make code look nicer.

Variables

Laiyes has 26 variables all initiated to 0, labeled a to z. Variables are either numbers (floating point) or strings.

Command Name Description Argument
a...z Store Assing the working value to one of the 26 variables
~ Recall Assign one of the 26 variables to the working value Variable
\ Reset Reset working value to 0
'...' String Assign a string to the working value

I/O

Command Name Description Argument
, Output Print the working value
_ Output variable Print a variable Variable
? Input Prompt user for input (input is a string of n length
"..." Print Print a string

Operators

Laiyes treats strings containing a properly formatted number as numbers.

'1'+'1',

Will output 2, not 11.

Command Name Description Argument
+ Add Add to working value, if string concatenates the working value and argument as strings Number, String, Variable, Input
- Subtract Subtract from the working value Number, Variable, Input
* Multiply Multiply working value Number, Variable, Input
/ Divide Divide the working value Number, Variable, Input
% Modulo Take the modulus of the working value Number, Variable, Input
^ Power Take working value to the power of n (supports decimals) Number, Variable, Input
& Concatenate Concatenate working value as string with argument Number, String, Variable, Input
` Take Take the nth element of a string (treats numbers as strings) (start indexing at 1) will return an empty string if index out of range Number, Variable, Input

Logic

All logic opererators must be ended with a : to indicate what code should be run if the condition is met. Logic operators consisting of multiple characters can have their characters appear in any order.

Command Name Description Argument
: End Marks the end of a logic statement
| Else Marks a section to execute if condition isn't met (placed after an End and must also be ended by it)
= Equal Executes code if working value is equal to argument Number, String, Variable, Input
!= / =! Not Equal Executes code if working value is not equal to argument Number, String, Variable, Input
> Greater Than Executes code if working value is more than argument Number, Variable, Input
>= / => Greater Than or Equal Executes code if working value is more or equal to argument Number, Variable, Input
< Less Than Executes code if working value is less than argument Number, Variable, Input
<= / =< Less Than or Equal Executes code if working value is less or equal to working value Number, Variable, Input

Flow

Command Name Description Argument
; Terminate Stop the program
(...) Loop Repeat code inside (you can use a conditional to escape from the loop by placing the end outside the bracket)
{...} While 0 Repeat code inside unless wokring value is equal to 0

Special

The command $ is used for special commands, its behaviour changes depending on the working value 'open:' and 'exe:' are optional inclusions for a full interperter

Working value Description
'' Clear output
'~' Clear variables
'256' Set working value to a sting of 256 unique characters
'open:' Open file (name after the :)
'exe:' Execute system command (command after the :)

Example programs

Hello, World!

"Hello, World!"

Truth-machine

?{,},

Fibonacci sequence

+1xy,(,+xz~yx~zy)

Factorial

+1y?x{~y*xy~x-1x}_y

FizzBuzz

(''y~x+1x%3=0'Fizz'y:~x%5=0~y&'Buzz'y:~y=''~x:,)

Prime numbers generator

+2,-1x(~x+2x+3/2z{~z-1z~x%z}~z=1_x:)

99 bottles of beer

+99x(''&x&' bottles of beer on the wall, '&x&' bottles of beer',~x-1x'Take one down, pass it around, '&x&' bottles of beer on the wall',~x=!1):
"1 bottle of beer on the wall, 1 bottle of beer""Take it down, pass it around, no more bottles of beer on the wall""No more bottles of beer on the wall, go to the store and buy some more""99 bottles of beer on the wall, 99 bottles of beer"

Turing completeness

Game of Life

''k"X"?y"Y"?z"Seed"?x~y*zv(~x*28763678276382+29839784974867%278374678323x`1%2=1~k+"X"k:|~k+" "k:~w+1w%v=!0):(\a''c(~a+1a~k`ab~c+bc~a%y=0_c''c:~b=!""):"--------------------"''$
m\a(~a+1a\b~a+1c~k`c="X"~a%y=!0~b+1b::~a+1+yc~k`c="X"~a%y=!0~b+1b::~a+1-yc~k`c="X"~a%y=!0~b+1b::~a-1c~k`c="X"~a+y-1%y=!0~b+1b::~a-1+yc~k`c="X"~a+y-1%y=!0~b+1b::~a-1-yc~k`c
="X"~a+y-1%y=!0~b+1b::~a+yc~k`c="X"~b+1b:~a-yc~k`c="X"~b+1b:~k`a="X"\c~b=3\+1c~m+"X"m:=2\+1c~m+"X"m:~c=0~m+" "m::|~b=3~m+"X"m:|~m+" "m::~a=!v):~mk)

With a small alteration the program can be made to allow the user to input any starting state to simulate.

brainfuck interperter

'256'$`1q'256'$`11j'256'$k\+1r"Memory size:"?x''m{~m&qm~x-1x}"Code:"?c''o$(#~p+1p~c`pi=""~o=!"",:;:=">"~r+1r>q;::="<"~r-1r<1;::="["~m`r=q\y(~p+1p~c`p="]"~y-1y:="["~y+1y:~y=!-1):::="]"~m`r=!q\y(~p-1p~c`p
="["~y-1y:="]"~y+1y:~y=!-1):::="."~m`rx=j_o''o:|~o&xo::="+"~m`ry\x(~x+1x~k`x=!y):~x+1x=256\+1x:~k`xy''n\x(~x+1x=r~n&yn:|~m`xz~n&zn:~m`x=!''):~nm:="-"~m`ry\x(~x+1x~k`x=!y):
~x-1x=0\+256x:~k`xy''n\x(~x+1x=r~n&yn:|~m`xz~n&zn:~m`x=!''):~nm:=","?y''n\x(~x+1x=r~n&yn:|~m`xz~n&zn:~m`x=!''):~nm:)

Due to the lack of support for lists, a string is used, making the interperter very slow, to compensate the user must set the size of the memory.
Due to the usage of $ this interperter only works in revision 1.2 or higher

Implementation

Laiyes rev 1.2 interperter, zipped, includes brainfuck interpreter.