Temperatures
You can define ^temperature declarations in your recipes using the ^ symbol.
Gram supports two formats for a ^temperature to accommodate both precise baking requirements and subjective stovetop cooking instructions: Exact Temperatures and Semantic Temperatures.
Exact temperatures
Section titled “Exact temperatures”Exact temperatures must specify a numeric value and a valid unit: C or F, case-insensitive, with or without the leading degree sign (°C/°F). Whatever spelling you use, the compiler normalizes it to the canonical °C/°F form in its output.
Temperature names
Section titled “Temperature names”Just like a ~timer, you can assign a specific name to a ^temperature. This is especially useful for clarity, allowing tools (like the CLI) or custom UI renderers to quickly extract and highlight key step information at a glance (e.g. which appliance needs to be set).
Semantic temperatures
Section titled “Semantic temperatures”For stovetop cooking or subjective instructions where an exact degree measurement doesn’t make sense, you can use semantic ^temperature strings. This allows you to write generic free-text strings.
Error handling
Section titled “Error handling”Only Celsius and Fahrenheit are supported — no Kelvin or other scales. The compiler validates ^temperature declarations and will output specific warnings for malformed exact temperatures:
- Missing Unit: If you write
^{200}without specifyingCorF, the compiler warnsMISSING_UNIT. - Invalid Unit: If you provide a numeric value with an unrecognized unit (e.g.,
^{200K}), the compiler warnsINVALID_UNITand keeps the raw value as written.