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
[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 & GitAutomatic Calculations
Stop calculating hydration or portion sizes manually. The language natively handles arithmetic expressions, variable declarations, and unit conversions.
Learn more: Automatic CalculationsModular 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 & timelinesDedicated 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 SupportPowerful 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 CLIGram 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
---
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
| Nutrient | Per portion | Per 100 g |
|---|---|---|
| Energy | 220 kcal920 kJ | 340 kcal1423 kJ |
| Fat | 21.6 g | 33.4 g |
| Carbohydrates | 5.5 g | 8.5 g |
| of which sugars | 5.5 g | 8.5 g |
| Fiber | 0 g | 0 g |
| Protein | 1.4 g | 2.2 g |
| Salt | 0 g | 0 g |
{
"shopping_list": [
{
"id": "heavy-cream",
"name": "heavy cream",
"qty": 1,
"unit": "cup",
"normalizedMass": 240,
"isEstimate": true,
"conversionMethod": "estimate"
},
{
"id": "powdered-sugar",
"name": "powdered sugar",
"qty": 2,
"unit": "tbsp",
"normalizedMass": 15,
"isEstimate": true,
"conversionMethod": "estimate"
},
{
"id": "vanilla-extract",
"name": "vanilla extract",
"qty": 1,
"unit": "tsp",
"normalizedMass": 4,
"isEstimate": true,
"conversionMethod": "estimate"
}
]
}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)
---
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}.{
"title": "Lemon Tart",
"serveAt": "2026-11-21T20:00",
"timeZone": "Europe/Paris",
"days": [
{
"date": "2026-11-20",
"visits": [
{
"startLocal": "2026-11-20T19:48",
"endLocal": "2026-11-20T20:00",
"sections": [
0
]
}
],
"threads": [
{
"visit": 0,
"fromLocal": "2026-11-20T20:00",
"toLocal": "2026-11-21T04:00",
"range": {
"min": 480,
"max": 1440
}
}
]
},
{
"date": "2026-11-21",
"visits": [
{
"startLocal": "2026-11-21T19:38",
"endLocal": "2026-11-21T20:00",
"sections": [
1
]
}
],
"threads": []
}
]
}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)
@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)- MixThe flour (125g), butter (62.5g), powdered sugar (45g), and water (17.5g).
Lemon Tart
- LineThe tart ring with &crust (250g).
- BakeBlind bake for 18min at 175°C.
- FillPour in the lemon curd (300g).
{
"modules": [
{
"binding": "crust",
"uri": "./bases/shortcrust.gram",
"scaleFactor": 0.5,
"mode": "inline"
}
],
"sections": [
{
"title": "Crust",
"intermediate_preparation": "crust",
"module": {
"binding": "crust",
"uri": "./bases/shortcrust.gram"
},
"ingredients": [
{
"id": "flour",
"qty": 125,
"unit": "g"
},
{
"id": "butter",
"qty": 62.5,
"unit": "g"
},
{
"id": "powdered-sugar",
"qty": 45,
"unit": "g"
},
{
"id": "water",
"qty": 17.5,
"unit": "g"
}
]
},
{
"title": "Lemon Tart",
"ingredients": [
{
"type": "reference",
"id": "crust",
"qty": 250,
"unit": "g"
},
{
"id": "lemon-curd",
"qty": 300,
"unit": "g"
}
]
}
]
}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
## Country Loaf
[Mix] The @*bread flour{400g}, @whole wheat flour{100g}, @water{75% @&bread flour}, @salt{2% @&bread flour}, and @levain{20% @&bread flour}.| Ingredient and weight | Percentage |
|---|---|
| Bread Flour - 400g | 100% |
| Whole Wheat - 100g | 25% |
| Water - 375g | 75% |
| Levain - 100g | 20% |
| Salt - 10g | 2% |
{
"shopping_list": [
{
"id": "bread-flour",
"name": "bread flour",
"modifiers": [
"bakers_percentage"
],
"qty": 400,
"unit": "g",
"normalizedMass": 400,
"isEstimate": false,
"conversionMethod": "physical",
"bakersPercentage": 100
},
{
"id": "whole-wheat-flour",
"name": "whole wheat flour",
"qty": 100,
"unit": "g",
"normalizedMass": 100,
"isEstimate": false,
"conversionMethod": "physical",
"bakersPercentage": 25
},
{
"id": "water",
"name": "Water",
"relative": true,
"normalizedMass": 300,
"isEstimate": false,
"conversionMethod": "relative",
"qty": 300,
"unit": "g",
"bakersPercentage": 75
},
{
"id": "salt",
"name": "Salt",
"relative": true,
"normalizedMass": 8,
"isEstimate": false,
"conversionMethod": "relative",
"qty": 8,
"unit": "g",
"bakersPercentage": 2
},
{
"id": "levain",
"name": "levain",
"relative": true,
"normalizedMass": 80,
"isEstimate": false,
"conversionMethod": "relative",
"qty": 80,
"unit": "g",
"bakersPercentage": 20
}
]
}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 LanguageContribute
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: ContributeStart 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