Numlex Documentation
Syntax Reference
Report issue

Sheet language

How a sheet is written and evaluated: notation, line forms, names, strict versus quiet lines, and the total command.

A Numlex sheet is a stack of logical lines. You type an ordinary line of notebook text, and a checked result appears in the answer column beside it.

This page is the formal starting point for the sheet language: the notation used across the reference, every form a line can take, the rules for names and assignments, the difference between strict lines and quiet prose, and the built-in total command.

Notation

The reference uses a small set of placeholders:

PlaceholderMeaning
<expr>any arithmetic expression
<value>a numeric value
<unit>a unit, or an expression over units
<place>free-text place name (up to 100 characters)
<Answer Token>an inserted answer token (marker U+FFFC)

Syntax words are English. Where noted, they are case-insensitive — OF works like of, Per Day like per day. The interface language and the regional number format are independent settings: localization never changes the syntax itself.

One line, one result

Each logical line produces one result in the right-hand column. Lines are evaluated from top to bottom, and a name declared on one line is visible to the lines below it.

Line forms

FormExampleBehavior
Empty lineNo result.
Heading# Payroll sheetA visual heading; skipped in calculations.
Comment// week totalA skippable heading/comment line: no result, never part of a calculation (not an assignment, not a sheet name).
LabelTotal:A line ending in a colon is a label/divider; it evaluates as a skip.
Named valuebase pay = 4500<name> = <expr>: the name is 1–6 ASCII words (or a single token word), ≤ 40 characters, the first word starts with a letter, and the name contains no operators. The value is mutable — a later <name> = <expr> line overwrites it for the lines below.
Built-in totaltotalA command (case-insensitive) that sums the eligible lines of the current section — see The total command.
Numeric expression12 + 30 × 2See Operators & logic.
Percent & money15% of 490, $24 per daySee Percentages and Money & rates.
Units10 km to m, 90 km per 3 daySee Units & quantities.
Integer bases0x1F, 255 as hexSee Numbers & integer bases.
DatesMay 5 + 3 weeksSee Dates.
Networkweather in London, distance between …See Live data & geography.
Plain textbought cableQuiet: no result. The only legacy fallback — in numeric lines, unknown Latin words are struck out (5 apples + 3 → 8). Prose without numbers, and words in other alphabets, are never evaluated.

Strict lines and quiet prose

Most lines are allowed to be ordinary text: if Numlex cannot read a calculation, the line simply stays quiet. Three kinds of lines are strict instead — their shape claims the line completely, and a failed parse is an error rather than a fallback:

  • Money lines. A line containing a currency marker ($, €, 100 USD …) must parse completely as a money expression; otherwise it is a hidden error and nothing is guessed.
  • Date-shaped lines. May 5 + 43 (no duration word) is an error — never “reduced” to plain numbers.
  • Call-shaped lines. A line shaped like a function call (name() is strict: an unknown function is an error, not a parenthesized group.

Everything else stays quiet — including ordinary prose, which is never flagged.

Names and assignments

  • Declare a value with name = expression; the name then stands for that value in every line below.
  • Names are 1–6 ASCII words, at most 40 characters, the first word starting with a letter, with no operators inside.
  • Assignments are mutable: writing the same name again overwrites it from that point down.
  • Money values can be named too — declare lunch = $45 and later write 2 people × lunch (see Money & rates).
  • Sheet names are separate from Settings constants; the constants mechanism is documented in Custom units & constants.

The total command

The exact command is a line whose entire content is total (case insensitive). It evaluates the sum of the eligible results of the current section — since the sheet start or the nearest previous total, # heading or exact --- divider.

  • total lines do not re-count each other: a previously computed total is not part of the next total. An ordinary reference to a total line, however, is an ordinary line and is included.
  • Eligible: finite scalar numbers — including the percent and multiplier display kinds, named scalars, and exact integers (exact for |v| ≤ 2^53).
  • Not eligible: money, quantities with units, booleans, dates, errors, blank/label lines and derived aggregate rows.
  • Shadowing: an active named value or constant called total disables the command — the line becomes an ordinary named value.
  • The total line is a section sum inside the sheet. It is distinct from the app’s bottom Total bar, which sums the whole sheet regardless of sections, and from the subtotal / grand total commands — see Tags, subtotals & statistics.

Where to go next

Found an issue in these docs? Report it on GitHub