esolang

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

Expected: Hello World!

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

LineDoes
croak textPrint the text
quack textPrint the question and read a line as the answer
ribbit textSet the right answer
barkPrint True or False
beep nPrint a random whole number from 1 to n
cluck nSleep n seconds
*textA 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.

Expected: Quiz! What is the best site about esolangs?True I won't add more questions I'm lazy

A line with no command stops the program after two errors.

Expected: hi ERROR ERROR

Patterns it teaches

  • Camouflage: the commands are animal sounds, and only the words change.

Further

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 frog

Source

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