Recipescript

From Esolang
Jump to navigation Jump to search

RecipeScript

Recipescript is a Python-based joke esolang created by dreamVoyager that can't actually be run by any program. Instead, the compiler is the brain of whoever's reading the code, and its output is a physical (and edible, if everything went well) object.

How does it work?

The program is read as any other program, and must be compiled by the reader. Generally, RecipeScript programs start by listing the ingredients, then defines a cooking function, and runs this function. Finally, the .eat() function is called, and the program ends.

Some examples

Mashed Potatoes

Mashed potatoes. Simple.

potato = {"Potato": 2}
ingredients = {"Milk": 1 cup, "Butter": 1 tablespoon}
def mashed_potatoes(ingredients, potato)
    peeler.peel(potato)
    board.add(potato)
    board.cut(potato, cubes)
    stove.add(pot)
    pan.add(water)
    stove.heat(pot)
    if water.temp == 100ºC:
        board.transfer(pot)
        pot.boil(15 min)
    pot.transfer(bowl)
    bowl.mash
    for i in ingredients:
        bowl.add(i)
    bowl.mix
    bowl.transfer(plate)
    plate.season("Salt", "Pepper")
cook(mashed_potatoes)
plate.eat(mashed_potatoes)

D Variant

This is a slight variant of Recipescript by Digin (made with permission from the creator) with slightly different syntax.

Example

A very simple recipe for peanut butter cookies.

def pb_cookies(plate):
    m = mixer()
    o = oven()
    s = sheet()
    ingredients = [ingredient("egg",2),ingredient("peanut butter",2 cup), ingredient("sugar",1 cup)}
    for i in ingredients:
      m.add(i)
    m.mix()
    s.addParts(m.contents, 2 cup)
    for i in s.contents:
      i.flatten()
      i.sprinkle(ingredient("sugar",5 g))
    o.add(s)
    o.bake(30 s)
    o.transfer(plate)
  p = plate()
  pb_cookies(p)
  p.eat()