The Cheffers Cookbook

For the fridge door

The Pantry Reference

Every instruction, measure and rule — one page, no fluff. Square brackets mean “optional”.

The recipe skeleton

Parts appear in this order, each separated from the next by a blank line:

PartRequired?Notes
Recipe Title.yesfirst line, ends with a period
comment paragraphnofree text; ignored by the interpreter
Ingredients. + one per linenodeclares your variables
Cooking time: 25 minutes.nopure theatre — does nothing
Pre-heat oven to 180 degrees Celsius.noalso theatre
Method. + sentencesyesthe program; line breaks don't matter
Serves N.to print anythingprints the first N baking dishes, each from the top down
auxiliary recipesnofull recipes below the main one, called with Serve with

Ingredients & measures

Declared as [value] [[heaped | level] measure] name — e.g. 108 g lard, 2 cups flour, 111 cups oil, pancakes. The value is optional (fill it later with Take or Fold; using it while empty is a runtime error). Names may contain spaces. Declaring the same name twice keeps the newest value.

MeasureStatePrints as
g, kg, pinch(es)drynumber
ml, l, dash(es)liquidcharacter (Unicode)
cup(s), teaspoon(s), tablespoon(s), or no measureeithernumber, until liquefied
heaped / level + any measuredry, definitelynumber

Bowl basics

InstructionWhat it does
Put ingredient into [the] [nth] mixing bowl.pushes the ingredient's value on top of the bowl (ingredient keeps its value)
Fold ingredient into [the] [nth] mixing bowl.the opposite, despite the wording: takes the top value off the bowl and stores it in the ingredient
Clean [the] [nth] mixing bowl.empties the bowl
Pour contents of the [nth] mixing bowl into the [pth] baking dish.copies the bowl onto the dish, order intact, on top of what's there; the bowl keeps its contents

Bowls and dishes are stacks: add to the top, take from the top, serve from the top. There's an unlimited supply of both — name them the 2nd mixing bowl, the 3rd baking dish… (digits + st/nd/rd/th). No number means the first.

Kitchen math

All arithmetic hits whatever value is on top of the bowl; the named ingredient is the other operand and is never used up.

InstructionTop of bowl becomes
Add ingredient [to [the] [nth] mixing bowl].top + ingredient
Remove ingredient [from [the] [nth] mixing bowl].top − ingredient
Combine ingredient [into [the] [nth] mixing bowl].top × ingredient
Divide ingredient [into [the] [nth] mixing bowl].top ÷ ingredient (whole numbers; the fraction is discarded)
Add dry ingredients [to [the] [nth] mixing bowl].pushes the sum of all dry ingredients as a new value

Texture & rearranging

InstructionWhat it does
Liquefy ingredient.the ingredient now prints as a character
Liquefy contents of the [nth] mixing bowl.everything currently in the bowl prints as characters
Stir [the [nth] mixing bowl] for N minutes.the top value sinks N places down the pile (or to the bottom, if the pile is short)
Stir ingredient into the [nth] mixing bowl.same, sink-depth taken from the ingredient's value
Mix [the [nth] mixing bowl] well.shuffles the bowl randomly

Control flow

InstructionWhat it does
Verb the ingredient.loop start: if the ingredient is 0, skip past the matching end; otherwise run the body
Verb [the ingredient] until verbed.loop end: verbed must echo the opening verb; if an ingredient is named here, it drops by 1 each lap; then the opening ingredient is re-checked
Set aside.break out of the innermost loop immediately
Serve with auxiliary recipe.call the named helper recipe (see below)
Refrigerate [for N hours].end this recipe now; with “for N hours”, print the first N baking dishes first

In & out

InstructionWhat it does
Take ingredient from refrigerator.reads one number from input into the ingredient (playground: the Input panel, whitespace-separated, one per Take)
Serves N.the recipe's final line: prints dishes 1…N, each emptied from the top. No Serves, no output

The sous-chef contract

Character codes you'll actually use

CharacterCodeCharacterCode
newline10digits 0948–57
space32AZ65–90
!33az97–122
.46?63

Remember: dry values print as numbers, back to back with no separator. Put a 32 ml water (space) or 10 ml anything (newline) between them.

Common kitchen disasters

SymptomLikely cause
parse error on a sentencea typo'd verb or ingredient — Chef never shrugs and moves on
runtime error: “declared without a value”you used an ingredient before Take or Fold filled it
runtime error on Add/Remove/Combine/Dividethe bowl was empty — arithmetic needs a top value to season
runtime error: loop exceeded its limitthe checked ingredient never reaches 0 (Cheffers stops runaway loops at 10 million laps)
no output at allyou forgot Serves 1. — or never poured into a baking dish
output is a number mush like 54321dry numbers have no separators; add a splash of water (32 ml)
letters print as numbersthe values are still dry — Liquefy them
message comes out backwardsstacks! last in, first out — push your message in reverse

House notes (this interpreter)

Where the official spec is silent, Cheffers makes these calls: all values are integers and division truncates toward zero; loops are capped at 10 million laps; sous-chefs stack at most 64 deep; Mix well in the playground uses a fixed random seed, so shuffles are reproducible there. The full details live in the README's conformance notes.