esolang

Snack

A language made to eat someone. It counts the people and asks if you are happy.

SmallBug, 2011 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: You have eaten as a snack right 2 people. Happy? SLEEP? ARE YOU CRAZY? LETS GET UP FOR MIDNIGHT DINNER

The idea

SmallBug made Snack in 2011. A program is a list of six words, and the only thing it can remember is how many people you are about to eat. Every word prints a fixed line or changes that one count by 1.

The machine

WordDoes
graveSet the count to 0
getAdd 1
letTake 1 away; one guy escapes
eatPrint the count in a sentence, then set it to 0
slimePrint that your victims are afraid of you
sleepPrint a refusal to go to sleep

Words are split on any whitespace, as the C++ interpreter reads them. Every other word does nothing. Each message ends in a line feed. The count starts at 0, as in the QB64 interpreter; the C++ one leaves it unset.

Example

The example eats two people and then tries to sleep.

The example eats two people and then tries to sleep.

let can take the count below 0, and eat starts it again from 0.

Expected: You have eaten as a snack right -1 people. Happy? You have eaten as a snack right 1 people. Happy?

The C++ interpreter would read its last word again forever at the end. The program stops, as the example output and the second interpreter in QB64 do.

Further

Also in Jokes

Write your own in Run Convert a program from Snack

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run snack -e 'slime'
shib manual snack

Source

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

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

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