Plain-text recipe DSL (GPL-3.0) compiling .gram files into deterministic JSON. Includes the compiler, backward scheduler, CLI, LSP, and VS Code extension. https://gram-lang.org
  • TypeScript 68%
  • MDX 22%
  • Vue 3.6%
  • CSS 2.8%
  • Astro 2.7%
  • Other 0.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-12-30 18:47:46 +01:00
docs docs: Fixed some code typos 2025-12-30 17:02:34 +01:00
gram-parser chore: build parser to verify it generates the d.ts files 2025-12-30 18:47:46 +01:00
gram-vscode-extension Initial release: Specification, Parser core, Playground and VSCode Extension 2025-12-28 21:28:39 +01:00
playground docs: Updated docs to reflect TS refactoring 2025-12-30 18:40:44 +01:00
.gitignore Initial release: Specification, Parser core, Playground and VSCode Extension 2025-12-28 21:28:39 +01:00
CONTRIBUTING.md docs: Added "Contributing to GRAM" 2025-12-28 22:39:53 +01:00
gram-banner.png docs: Added banner + syntax example correction 2025-12-29 20:25:12 +01:00
LICENSE Initial commit 2025-12-28 20:39:17 +01:00
README.md docs: Syntax error fix 2025-12-29 20:58:46 +01:00

GRAM - General Recipe Abstract Markup

A strictly typed, data-first recipe markup language for developers.

Status Open Source License

Gram Banner

GRAM is designed to write structured, machine-readable recipes without sacrificing readability. It treats recipes as code, compiling ingredients, instructions, and cookware into a strict AST (Abstract Syntax Tree) for precise analysis, scaling, and shopping list generation.

👉 Try the Online Playground (or run it locally)

🚧 Project Status: Active Development GRAM is currently in an Alpha stage. The syntax specification is stabilizing, but the parser logic is actively being refined. Breaking changes may occur. This is an Open Source project. We believe standardizing recipe data requires a community effort. Feedback, feature requests, and code contributions are highly welcome!

Please see CONTRIBUTING.md for more information on how to contribute to GRAM.


📚 Documentation

The full technical documentation is available in the docs/ folder.


🥘 Why GRAM?

Inspired by the excellent Cooklang, GRAM evolves the concept by enforcing a strict schema and advanced logic capabilities.

While Cooklang focuses on natural language fluidity, GRAM prioritizes data integrity and computational logic:

  1. Data vs. Narrative: Clear separation between ingredients (@flour{200g}) and instructions.
  2. Mise en Place: Distinguishes between the Shopping List (Aggregated totals) and the Section List (What you need on the table right now).
  3. Complex Relationships:
    • References (@&): Reuse previously measured ingredients without doubling the shopping list amount.
    • Intermediate Preparations (->&dough): Chain recipe parts like variables.
    • Relative Quantities: Define @water{60% @flour} for dynamic bakers math.
    • Composites: Handle "Zest of 1 lemon" and "Juice of 1 lemon" implying "Buy 1 Lemon".

⚡ Quick Syntax

## Dough {T-2h} 

[Mix] The @flour{200g} and @water{100ml}. ->&dough{}

[Add] The @&dough{} to a #bowl{}.

[Rest] For ~{30min}.

[Bake] In the #oven{} at !{200°C}.

🛠️ Project Structure

This monorepo contains:

  • gram-parser/: The core logic. Validates parsing, builds the AST, and compiles the Shopping List.
  • playground/: A web-based IDE to write GRAM and visualize the output (JSON, Markdown, Preview).
  • docs/: Comprehensive documentation.

🤝 Contributing

We need your help to make GRAM the standard for structured recipes!

Whether you are a developer, a chef, or a data enthusiast, your contributions are welcome.

  • Found a bug? Open an issue to help us squash it.
  • Have an idea? Start a discussion on syntax improvements.
  • Want to code? Fork the repo and submit a Pull Request.

📦 Try it out

1. Run the Playground locally

To inspect the parser or test your recipes in the web-based playground IDE :

cd playground
npm install
npx serve

2. Use the Parser

(See gram-parser/README.md for API details)

const { parse } = require('gram-parser');
const result = parse(myGramString);

console.log(result.shopping_list);

👏 Acknowledgments

GRAM stands on the shoulders of giants.

  • Cooklang: For pioneering the concept of a recipe markup language. GRAM was heavily inspired by their concise syntax.
  • Ohm.js: For making parsing accessible and robust.
  • LLM Assistance: This project was developed with the assistance of AI for rapid prototyping, refactoring, and generating test cases. All logic and architecture were strictly verified by humans.

License

Distributed under the GPL-3.0 License.