Gram

Code your recipes.

An open-source declarative and computational recipe DSL. Built to handle complex culinary logic, Gram compiles your plain-text instructions into structured, calculated, and relational data.

lemon-curd.gram
## Lemon Curd

[Mix] Whisk the @lemon juice{100 g}<@lemons{3}, @eggs{2}, and @sugar{120% @&lemon juice} in a #saucepan{}. ->&base

[Cook] Heat the &base to ^{180°F} over medium heat for ~{5min}, until ={thickened}.

[Emulsify] Remove from heat and blend in the @butter{120 g}. Chill for ~_fridge{2h}.

Design Philosophy

Gram is built to be simple to write, easy to version, and powerful to parse.

Plain Text & Git

No proprietary database or vendor lock-in. Your recipes are simple text files that can be versioned with Git, shared easily, and edited in any text editor.

Learn more: Plain Text & Git

Automatic Calculations

Stop calculating hydration or portion sizes manually. The language natively handles arithmetic expressions, variable declarations, and unit conversions.

Learn more: Automatic Calculations

Modular Recipes (@use)

Stop duplicating doughs, stocks, and sauces across files. Break shared sub-recipes into standalone files and import them anywhere with a single line.

Learn more: Modular Recipes (@use)

Retro-planning & timelines

Gram analyzes passive cooking, chilling, and prep times to calculate the exact moment to start each step. Everything converges hot and ready at serving time.

Learn more: Retro-planning & timelines

Dedicated IDE Support

Powered by a dedicated Language Server (LSP) giving you real-time diagnostics, semantic highlighting, and autocomplete directly in your IDE.

Learn more: Dedicated IDE Support

Powerful CLI

Manage your workspace directly from the terminal. The official CLI lets you initialize projects, format files, and compile your recipes with ease.

Learn more: Powerful CLI

Gram in Practice

A few examples of how the compiler parses plain text into structured recipe data.

Database & Nutrition

Standardize measurements and calculate nutrition using a local database generated automatically from your workspace. Learn more: Database & Nutrition

input.gram
---
portions: 4
---

## Chantilly Cream

[Whisk] The @heavy cream{1 cup} and @powdered sugar{2 tbsp} until ={soft peaks} form.

[Fold] Gently incorporate the @vanilla extract{1 tsp}.
  • heavy cream1 cup240 g
  • powdered sugar2 tbsp15 g
  • vanilla extract1 tsp4 g
Nutrition informationEstimate
NutrientPer portionPer 100 g
Energy220 kcal920 kJ340 kcal1423 kJ
Fat21.6 g33.4 g
Carbohydrates5.5 g8.5 g
of which sugars5.5 g8.5 g
Fiber0 g0 g
Protein1.4 g2.2 g
Salt0 g0 g

Your plan, computed (ALAP)

Gram computes your schedule from the durations you write: working backward from the service, as late as possible, it works out the days, the visits to the kitchen and what to take out. Learn more: Your plan, computed (ALAP)

input.gram
---
title: Lemon Tart
---

## Dough ->&dough ~{-1d}

[Mix] Rub the @flour{250g} with @butter{125g} for ~{10min}.

[Chill] Let the dough rest for ~_{8-24h}.

## Tart

[Bake] Line the #tart ring{} with the &dough and blind bake for ~{20min}.
Run sheet for the lemon tart served Saturday, November 21 at 8 p.m. Friday: a visit to the kitchen at 7:50 p.m. for the dough, which rests in the fridge. Saturday: a visit at 7:40 p.m. for the tart, then serving at 8 p.m.

Modular Recipes (@use)

Import shared base preparations with @use. Gram resolves dependencies, inlines preparation steps into the recipe, and scales quantities automatically. Learn more: Modular Recipes (@use)

input.gram
@use "./bases/shortcrust.gram" as &crust

## Lemon Tart

[Line] The #tart ring{} with the &crust{250g}.

[Bake] Blind bake for ~_oven{18min} at ^{350°F}.

[Fill] Pour in the @lemon curd{300g}.

Crust

📦 bases/shortcrust.gram → crust (×0.5)
  1. MixThe flour (125g), butter (62.5g), powdered sugar (45g), and water (17.5g).

Lemon Tart

  1. LineThe tart ring with &crust (250g).
  2. BakeBlind bake for 18min at 175°C.
  3. FillPour in the lemon curd (300g).

Baker's Math & Precision

Supports baker's percentages. Declare ingredients relative to a base ingredient to easily scale your recipes. Learn more: Baker's Math & Precision

input.gram
## Country Loaf

[Mix] The @*bread flour{400g}, @whole wheat flour{100g}, @water{75% @&bread flour}, @salt{2% @&bread flour}, and @levain{20% @&bread flour}.
Baker's percentages for the recipe
Ingredient and weightPercentage
Bread Flour - 400g100%
Whole Wheat - 100g25%
Water - 375g75%
Levain - 100g20%
Salt - 10g2%

Get Involved

Explore the Language

The official documentation provides a complete guide to Gram's syntax, tooling, and inner workings. Ideal for getting started or deep-diving into the language.

Read the docs: Explore the Language

Contribute

Gram is built openly and collaboratively. You can browse the source code, report issues, or submit patches to the compiler and documentation.

View on official repository: Contribute

Start Cooking

Scaffold a new recipe workspace in seconds. The CLI sets up everything you need to start writing Gram locally.

npx @gram-lang/cli init