Frog
Six frog sounds, one per line. The frog can print, ask a question and tell you whether you got it right.
Stysan · Turing complete: no · ●○○ easy · esolangs.org
Tested with 8 known programs · Test method
Run it
The idea
Stysan made Frog with commands named after the sounds frogs make, and a syntax after Windows batch files. A program is a list of lines and runs once from top to bottom. There are no loops, no jumps and no variables you can name, so every program ends. The specification counts it as unusable for programming.
Read the story
The original interpreter is 32 lines of Python, and this implementation follows it, down to a slip in its error handling. A line it does not know prints ERROR twice. Its bug() prints ERROR and calls quit(), but the call sits inside a bare try and except, which catches the exit and calls bug() once more.
The machine
| Line | Does |
|---|---|
croak text | Print the text |
quack text | Print the question and read a line as the answer |
ribbit text | Set the right answer |
bark | Print True or False |
beep n | Print a random whole number from 1 to n |
cluck n | Sleep n seconds |
*text | A comment |
Example
The quiz sets the answer first, then asks.
The quiz sets the answer first, then asks. The question has no line feed after it, so the verdict lands on the same line.
A line with no command stops the program after two errors.
Patterns it teaches
- Camouflage: the commands are animal sounds, and only the words change.
Further
See also
Also in Jokes
Write your own in Run Convert a program from Frog
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: frog.
Command line
shib run frog -e 'bark'shib manual frogSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/frog.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org