esolang

potatoscript

A script is two tildes and whatever you put between them, read one character at a time.

nanobot567, 2021 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hello world!

The idea

nanobot567 made potatoscript in 2021, with an interpreter in Python 3.9. That interpreter has no lexer and no tokens. A for loop walks the file one character at a time and does what each one says. A script only has to start and end with ~, so a single ~ is already a valid program.

Read the story

Text is printed between - and _. Besides that the script holds one string and one number, and a % changes what the command next to it does. With %_ a print leaves out its line break, and with #% the input is read as a number.

The machine

CommandDoes
~Start and end the script
-text_ -text%_Print the text with a line break, or without
/Print a line break
# #%! #%Read a line into the string, add one to its end, or read a number
$ ^Print the string or the number, each on its own line
* + ` | Set the number to 0, add 1, take 1
@ !Sleep for the digit after it; stop

The specification also has > and & to multiply and divide, and % in front of a math indicator to use the digit before it, or 5. It leaves too much of those open, so this implementation runs without them and stops with an error where a script uses one.

Example

The specification says ~-Hello_/-there_~ prints Hello, a newline, then there.
Expected: Input: You typed potato
Expected: 42

The specification says ~-Hello_/-there_~ prints Hello, a newline, then there. Since _ already ends its line, the / makes a blank line between the two words.

Expected: Hello there

Further

Also in Jokes

Write your own in Run Convert a program from potatoscript

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: potatoscript.

Command line

shib run potatoscript -e '~-Hello world!_~'
shib manual potatoscript

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/potatoscript.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org