Skip to main content

ChefScript: an esolang for storing, creating and using recipes

Installation

pip install ChefScript

Usage

ChefScript [-h] [<filename>]

Example of usage

ChefScript code

seasoned steak
    2 lb of New York strip steak (pat dry)
    1 1/2 tsp of salt (apply onto both sides)
    1 tsp of black pepper (
        apply onto both sides,
        rub in
    )

cook seasoned steak with 1 lb of New York strip steak

Output

--------------------Cooking seasoned steak with scale 0.500 --------------------
Recipe for seasoned steak:
    Summary of ingredients:
        1.000 lb of New York strip steak
        0.500 tsp of black pepper
        0.750 tsp of salt
    Instructions:
        1.000 lb of New York strip steak (pat dry)
        0.750 tsp of salt (apply onto both sides)
        0.500 tsp of black pepper (
        apply onto both sides,
        rub in
    )
--------------------------------------------------------------------------------

Components of ChefScript

Number

A number in ChefScript is a list of whitespace-separated floats or quotients (fraction of two floats). Its value is the sum of all floats and quotients in the list.

1/2 (this is 0.500)
1 1/2 (this is 1.500)
1.3e2 15 .5e1 (this is 150.000)

The purpose of this design is to make it possible to write 1 1/2 like a recipe book will do, instead of 1.5 which is less commonly used.

Quantity

A quantity is a number followed by a unit. It is recommended to write a unit case-insensitively (mL is different from ML, but mL is the same as ml), and using spaces to separate words (fl oz or fl. oz. looks better than fl_oz). It is recommended but not mandatory to put a space between the number and the unit.

1 cup
1 1/2 cups
50 fl oz

Ingredient

An ingredient is a quantity followed by the keyword of and a name. It is recommended to write a name using spaces to separate words (chicken breast looks better than chicken_breast), but sometimes an underscore as to be used when a word is in conflict with a keyword.

1 lb of chicken breast

Recipe

A recipe is a name followed by a list of ingredients or other recipes, and optionally together with a list of instructions. The name follows the same rules as an ingredient's name. The instruction is a comment that starts on the same line as an ingredient or a recipe inside the recipe.

seasoned steak
    2 lb of New York strip steak (pat dry)
    (
        you can put a comment here as well,
        but it won't be recognised as an instruction.
    )
    1 1/2 tsp of salt (apply onto both sides)
    1 tsp of black pepper (
        apply onto both sides,
        rub in
    )

When an ingredient is mentioned more than once in a recipe, it will be considered a new one each time, and the quantities will be added together. When a recipe is mentioned more than once in a recipe, it will be considered the same reused, and the quantities will not be added together.

Comment

A comment starts with ( and ends with ). It can be placed at the end of any line, and can run for multiple lines. When put at the end of a line with an ingredient or a recipe, it will be recognised as an instruction.

(
    this is a comment
    that runs for multiple lines
)

Function

Currently, there is only one built-in function in ChefScript, which is cook. It takes a recipe and an optional scale as arguments, and prints out the recipe with the scale applied to all quantities. The scale can be a number or an ingredient, recognised by different keywords used with cook.

cook seasoned steak
cook seasoned steak for 2 times
cook seasoned steak with 1 lb of New York strip steak

Keywords and delimiters

The keywords are

of
cook
for
times
with

The delimiters are

(
)

These should be avoided in names.

Metadata

Release files for ChefScript 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ChefScript 0.1.1
File Size Uploaded Provenance Actions
ChefScript-0.1.1.tar.gz 14.6 kB Without provenance Details for ChefScript-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ChefScript 0.1.1
File Interpreter ABI Platform Actions
ChefScript-0.1.1-py3-none-any.whl Python 3 none any Details for ChefScript-0.1.1-py3-none-any.whl

Total release size: 27.2 kB

Release files / ChefScript-0.1.1.tar.gz

Download URL ChefScript-0.1.1.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b7818781a1104918ce3792bfe66f2852a1b19acb6f0b0cb7cfd75ba77c3e0d86
BLAKE2b-256 checksum
How to use checksums
d3d75b9b4b995a25d362b73d777624c8e379695c87b715a1250cb4ba623b3cba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Release files / ChefScript-0.1.1-py3-none-any.whl

Download URL ChefScript-0.1.1-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd99e5cbc509552ff35ed7428921b2e1bfa7e73f630329c175c3a10b7e6ae6fd
BLAKE2b-256 checksum
How to use checksums
bced44cb48d9fdf47316c73da28bbea6c92130f05d1240174b6e64ac9cf0be24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.1

Security for ChefScript 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page