potatoscript
potatoscript is an esoteric programming language based on single-character commands, made by nanobot567.
General information
potatoscript is coded in Python 3.9. Its parser does not use the usual methods of creating a programming language, such as using a lexer and tokenization, but instead uses a for loop to check each character in the file, and as it does so, performs the specified actions accordingly.
Programming
Basics
A potatoscript only requires that there be a beginning and end indicator in the file for it to be valid. Tildes are these indicators. For example, the following code can be executed with no errors:
~
Most commands in potatoscript do not have any specific syntax, but there are exceptions. One is the print start indicator (-), which requires an end indicator before the end of the script.
Example potatoscripts
This potatoscript is the classic hello, world program:
~-Hello world!_~
This prints "Hello", a newline, then "there":
~-Hello_/-there_~
This gets input from the user and prints it:
~-Input:_#-You typed_$~
Indicators (commands)
- "~" - start and end script
- "-" - print start
- "_" - print end
- "/" - newline
- "#" - get input and store it
- "$" - print the stored string
- "*" - reset the stored number
- "+" - add one to the stored number
- "`" - subtract one from the stored number
- ">" - multiply the stored number by the integer specified
- "&" - divide the stored number by the integer specified
- "^" - print the stored number
- "@" - sleep for the integer after the indicator
- "%" - alt version of the indicator
Alt commands
+, -, >, & (math indicators)
depending on how you use %, these indicators can do different things.
if % is behind an integer and is in front of a math indicator, the stored number is increased, decreased, multiplied, or divided by that integer, depending on which indicator you use.
if not, the stored number is increased, decreased, multiplied, or divided by 5. NOTE: the integer to be used can only be 1 character long for the operation to work as expected.
_ (print end)
if % is in front of _, the string printed has no newline printed at the end.
# (get input)
if % is used, the input gathered from the user is stored as an integer. if the input statement looks like the following: #%!, then the input will be appended to the stored string.
Limitations
For all of the math indicators, only integers with a length of 1 are accepted.
External Resources
- potscr on Github - Open-source potatoscript parser
- potatoscript on github.io - Potatoscript website