[Syntax] Relative quantities: Ratios based on a base ingredient unit #6

Open
opened 2026-07-17 23:02:45 +02:00 by abiwab · 0 comments
abiwab commented 2026-07-17 23:02:45 +02:00 (Migrated from codeberg.org)

Context

While baker's percentages are great, many recipes use ratios based on a specific unit of another ingredient. For instance, "1 egg per 100g of flour" (classic for pasta) or "1 garlic clove per 150g of beef".

Goal

Introduce a new syntax to express these ratios. This shouldn't be limited to discrete units; it is also necessary to support precise weight-to-weight ratios, such as "50g of egg per 100g of flour".

Extended Scope: Time Calculations

Interestingly, this syntax concept could also apply to step durations. For example: "Cook for 10 minutes per 200g slice of chicken". This opens the door to much more powerful computational expressions within the Gram language. Is there however that many cases where this could be useful and/or precise ?

Technical Challenges

The main complexity lies in designing an elegant, readable syntax that supports these advanced relational calculations without cluttering the language, and then implementing the underlying AST changes.

### Context While baker's percentages are great, many recipes use ratios based on a specific unit of another ingredient. For instance, "1 egg per 100g of flour" (classic for pasta) or "1 garlic clove per 150g of beef". ### Goal Introduce a new syntax to express these ratios. This shouldn't be limited to discrete units; it is also necessary to support precise weight-to-weight ratios, such as "50g of egg per 100g of flour". ### Extended Scope: Time Calculations Interestingly, this syntax concept could also apply to step durations. For example: "Cook for 10 minutes per 200g slice of chicken". This opens the door to much more powerful computational expressions within the Gram language. Is there however that many cases where this could be useful and/or precise ? ### Technical Challenges The main complexity lies in designing an elegant, readable syntax that supports these advanced relational calculations without cluttering the language, and then implementing the underlying AST changes.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gram-lang/gram#6
No description provided.