esolang

Bgt

A language written in 2 minutes and 22 seconds, with one letter for each program people ask for.

Cinnamony · Turing complete: no · ●○○ easy · esolangs.org

Tested with 5 known programs · Test method

Run it

Expected: Hello, World!

The idea

Cinnamony speedran Bgt and put the time in the specification, 2 minutes and 22.29 seconds. It has five commands. P prints the character after it, and each of the other four is a whole classic program. K is a cat, L is 99 bottles of beer, J is FizzBuzz and Z is a truth machine.

Read the story

The specification also gives an interpreter in Common Lisp, and this implementation follows that interpreter. The cat and the truth machine prompt with >>. Every command but P starts on a fresh line. Any other character, even a space between commands, is an error.

The machine

CommandDoes
PPrint the next character
KPrompt, then print one line of input
L99 bottles of beer
JFizzBuzz from 1 to 100
ZPrompt, read an integer, print 0 once or 1 forever

Example

P can print a space, so P is a command, but a bare space is not.
Expected: >> meow
Expected: >> 0

P can print a space, so P is a command, but a bare space is not. After P the output is not at the start of a line, so K begins with a line feed.

Expected: Hi! >> there

The interpreter's 99 bottles counts down twice for every verse, once in the loop and once in the body, where it computes the bottles that are left. So L sings the verses for 99, 97, 95 and so on down to 1, fifty in all, and the last one ends with No bottles of beer on the wall.

Further

Also in Jokes

Write your own in Run Convert a program from Bgt

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run bgt -e 'K' --input 'abc'
shib manual bgt

Source

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

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

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