/** * Text -> Equation. Pure (no DOM), and the inverse of exprToString up to the * structural invariants: the round-trip property * eq(parseEquation(exprToString(e)), e) * holds for every generated equation, which pressure-tests printer and * parser together. * * Grammar (recursive descent): * equation := expr REL expr REL: = < <= >= > ≤ ≥ * expr := term (('+'|'-') term)* a - b is Sum(a, Neg(b)) * term := factor (('*'|'·'|'/'|juxt) factor)* left-assoc; / builds Fractions * factor := '-' factor | power * power := atom ('^' factor)? right-assoc; x^-2 works * atom := INT | VAR | '(' expr ')' | ('sqrt'|'√') radicand * * Conventions matching the engine: * - Integers only — the engine is exact. Decimals are rejected with a hint * to write a fraction instead. * - Variables are single letters; juxtaposition multiplies (2x, x(x+1)). * - a/b becomes a Fraction whose lists absorb Product parts ((a·b)/c has * num [a, b]) — lists ARE implicit products, the engine's canonical form. */ import { type Equation } from "./expr.js"; export declare class ParseError extends Error { readonly position: number; constructor(message: string, position: number); } /** Parse user input into an Equation. Throws ParseError with a position. */ export declare function parseEquation(src: string): Equation; //# sourceMappingURL=parse.d.ts.map