Lakshayati
Three operations on strings. A program writes code into variables and runs it.
2020 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Lakshayati was made in 2020. Its name comes from a Sanskrit word that means "to define". It has no numbers, no conditions and no loops. There are only strings in global variables, and a line can do three things with them. It can assign a string, join strings end to end, or run a string as code.
Read the story
That is enough to decide. A program joins a piece of text and a variable into the name of another variable, and runs that name. The specification proves the language Turing complete with an interpreter for Smallfuck.
The machine
| Line | Does |
|---|---|
name values | Join the values and assign them to the variable |
/ values | Join the values and display them |
"code" values | Join the values and run the text as code |
name | Run the string in the variable as code |
A value is a string or a variable. A string sits in ', ", ''' or """ and may run over several lines. A variable is any run of characters without quotes or white space, so / is a variable too, and so is the full width /. Displaying adds no line break. The documentation also accepts the quotation marks of other languages; this implementation leaves those out and opens a string only with ' or ".
Example
The second program is the specification's own.
The second program is the specification's own. Its second line holds a variable alone, so it runs the string in new_variable, and that assigns hello world to variable.
A choice. The last line starts with a string, so it joins when_ and the value of bit and runs the result. That is the name when_1, alone on a line, which runs the string inside it.
The quine is 24 lines long. Three variables hold parts of its text and two hold the quote marks, and its last statement prints each part twice, once in quotes and once bare. It prints itself.
Patterns it teaches
- Code as data: every variable is text, and any text can be run.
- Quine: a program built from the strings that hold it.
- Turing tarpit: three operations, and decisions made by building names.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from Lakshayati
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: lakshayati.
Command line
shib run lakshayati -e '/ "hello world"'shib manual lakshayatiSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/lakshayati.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org