view interps/linguine/README @ 12500:e48c08805365 draft default tip

<b_jonas> ` learn \'The password of the month is Cthulhuquagdonic Mothraquagdonic Narwhalicorn.\' # https://logs.esolangs.org/libera-esolangs/2024-04.html#lKE Infinite craft
author HackEso <hackeso@esolangs.org>
date Wed, 01 May 2024 06:39:10 +0000
parents 859f9b4339e6
children
line wrap: on
line source

Linguine programming language
by Jeffry Johnston (linguine@kidsquid.com)
November 23, 2005


Introduction
------------
Linguine is designed as a successor to Spaghetti.  The word linguine means
flattened pasta or spaghetti.  True to this definition, Linguine programs
are much shorter and flatter compared to their long and skinny Spaghetti
ancestors.  However, both languages share the yummy feature that program 
lines may be arranged in any arbitrary order.  Linguine adds multiple 
pointers and unlimited storage and cell sizes for Turing completeness (and
that extra full quality).  The command set is similar to Spaghetti, 
although AND has been replaced by the more capable (and delectable) NAND, 
and there is an additional integer output command.  Try some Linguine to 
satisfy your saucy esoteric appetite... mmm carbs!


Syntax
------
The program line format is:

line[command]jump

Each part is required, so there must be a line, left bracket, at least one
command, a right bracket, and a jump.  Line is a unique line number for 
this program line.  Jump is the line number to jump to if all commands 
on this line have completed without jumping.  Line and jump are integer 
values.  Integers may be positive or negative and have no upper or lower 
bounds.  However, line may not be 0, as this line number is reserved for 
jumping to line 0 to exit the program.  There may be multiple commands per
program line, separated by commas.  Valid commands are:

Command         Meaning
-------         -------
x=y             Assignment (x=y)
x+y             Addition (x=x+y)
x-y             Subtraction (x=x-y)
x|y             NAND (x=x NAND y)
x>y             Bit shift (x=x>>y if y is positive, else x=x<<y)  
x?              Input (x=input), returns -1 on EOF
x$              Character output (output character x)
x#              Integer output (output integer x)
x<y:ifjump      Less than (if x<y then jump to ifjump)
x~y:ifjump      Equal to (if x==y then jump to ifjump)
x^              Time (x=Number of seconds since the epoch)

x, y, and ifjump are integers.  The x, y, and ifjump values may be 
dereferenced by preceding them with the `*' character.  Multiple 
dereferences may be done by prepending additional `*' characters.

If there are multiple commands on a line, each is executed in turn, left
to right, unless an ifjump occurs. 


Memory 
------
The memory tape indices extend without limit in both the positive and 
negative directions.  Each memory cell may store any integer value.  All
cells initially hold a value of 0.


Dereference
-----------
The x and y values work slightly differently (by default x is an address
and y is a plain value).  Take the following example commands:

10=20
 
So x is 10 and y is 20.  That means that cell 10 is assigned the value 20.

10=*20

That command assigns the value in cell 20 to cell 10.

*10=20

Now, the value 20 won't be assigned to cell 10, it will instead be 
assigned to the cell index given in (pointed to by) cell 10.

*10=*20

Finally, the value in cell 20 is assigned to the cell pointed to by cell
10.


Code comments
-------------
Linguine programs may include line comments with the ' (apostrophe)
character.  Everything on the line after the comment character will be 
ignored.


Line numbers and Jumps
----------------------
Every non-blank line (excluding comments) must have a leading line number.
Program execution will start at the lowest specified line number.  Line 
numbers may be negative.

Every non-blank line must also specify the line that will next be jumped 
to.  Jumping to line 0 exits the program. 

Jump and ifjump values may be dereferenced in a manner exactly as the y
value.  A runtime error will be generated if a dereferenced jump line 
number is not defined in the program, even if that line would not be 
branched to by the instruction.


History
-------
November 23, 2005       Started
November 24, 2005       Released
November 25, 2005       Amended to include jump dereferencing.  This 
                        change does not affect existing programs, although
                        some may be more simple now.


Examples
--------
'Hello World in Linguine
'Programmed by Jeffry Johnston, 2005
1[0=72,0$,0+29,0$,0+7,0$,0$,0+3,0$,1=32,1$,0-24,0$,0+24,0$,0+3,0$,0-6,0$,0-8,0$,1+1,1$,1-23,1$]0


'Cat program in Linguine
'Programmed by Jeffry Johnston, 2005
1[0?,0$,0~10:0]1


'Fibonacci sequence calculator in Linguine
'Programmed by Jeffry Johnston, 2005
1[0=32,2=1,1#,0$,2#]2
2[1+*2,3=*1,1=*2,2=*3,0$,2#]2


'99 bottles of beer in Linguine
'Programmed by Jeffry Johnston, 2005
1[0=99,2=32,3=10,4=44,5=46]2
2[1=0]8
3[4$,3$,1=1]8
4[5$,3$,6=84,6$,6+13,6$,6+10,6$,6-6,6$,2$,6+10,6$,6-1,6$,6-9,6$,2$]5
5[6-1,6$,6+11,6$,6+8,6$,6-9,6$,4$,2$,6+2,6$,6-15,6$,6+18,6$,6$,2$]6
6[6-10,6$,6+11,6$,2$,6-19,6$,6+17,6$,6-3,6$,6+6,6$,6-7,6$,6-10,6$,4$,3$]7
7[0-1,1=2]8
8[0~0:9,0#]10
9[6=78,6$,6+33,6$]10
10[2$,6=98,6$,6+13,6$,6+5,6$,6$,6-8,6$,6-7,6$,0~1:11,6+14,6$]11
11[2$,6=111,6$,6-9,6$,2$,6-4,6$,6+3,6$,6$,6+13,6$,1~0:12,1~1:4]12
12[2$,6-3,6$,6-1,6$,2$,6+6,6$,6-12,6$,6-3,6$,2$]13
13[6+18,6$,6-22,6$,6+11,6$,6$,1~0:3,5$,3$,0~0:0,3$]2


'Digital root calculator in Linguine
'Programmed by Jeffry Johnston, 2005
1[1?,1~10:3,0+*1,0-49,0<9:2,0-9]2
2[0+1]1
3[0#,1$]0


'ROT13 in Linguine
'Programmed by Jeffry Johnston, 2005
1[-2?,-2~10:3,-2<65:2,-2<91:5,-2<97:2,-2<123:6]2
2[*-1=*-2,-1+1]1
3[*-3~0:4,*-3$,-3+1]3
4[-2$]0
5[-2+13,-2<91:2,-2-26]2
6[-2+13,-2<123:2,-2-26]2


'BF interpreter in Linguine (Turing completeness proof by implementation) 
'Programmed by Jeffry Johnston, 2005
1[*-2?,*-2~33:2,-2+1]1
2[*-2=-1,-2+1]3
3[-3=**-1,-3~-1:0,-3~43:4,-3~44:6,-3~45:7,-3~46:9,-3~60:10,-3~62:11,-3~91:12,-3~93:14]15            
4[*-2+1,*-2~256:5]15    '+
5[*-2=0]15
6[*-2?,*-2~-1:5]15      ',
7[*-2-1,*-2~-1:8]15     '-
8[*-2=255]15
9[*-2$]15               '.
10[-2-1]15              '<
11[-2+1]15              '>
12[*-2~0:13]15          '[
13[-3=1]16
14[-3=-1]16             ']
15[-1+1]3
16[-4=1]17
17[-1+*-3,*-1~91:18,*-1~93:19]20
18[-4+*-3]20
19[-4-*-3]20
20[-4~0:21]17
21[-3~1:15]3


'pi calculator in Linguine
'Programmed by Jeffry Johnston, 2005
1[0=1,1=0,2=1,3=1,4=46]2 
2[5=*0,5+*0,5+*0,-2=*5,-2+*1,-3=*2,-1=3]16    
3[6=*-2,-2=*5,-2+*0,-2+*1,-1=4]16             
4[6~*-2:8,-3=*3,-3+*3,-3+1,-2=*2,-1=5]14       
5[2=*-2,1+*0,1+*0,-2=*1,-1=6]14               
6[1=*-2,-2=*0,-3=*3,-1=7]14         
7[0=*-2,3+1]2
8[6#,4~46:9]10
9[4$,4=0]10
10[-2=*0,-3=10,-1=11]14                         
11[0=*-2,-2=*2,-3=*6,-1=12]14
12[1-*-2,-2=*1,-3=10,-1=13]14
13[1=*-2]2                                      
14[-4=*-3,-5=*-2,-2=0]15
15[-4~0:*-1,-2+*-5,-4-1]15
16[-4=*-2,-2=0]17
17[-4<*-3:*-1,-4-*-3,-2+1]17