Skip to content

Scope and limitations

Octant translates a bounded subset of mathematical LaTeX. When the input falls outside that subset, Octant fails fast with a structured error rather than silently producing wrong Chelis. This chapter describes what Octant does not translate, the rewrite for each case, and the error catalog organized by exit code.

Octant translates math. It does not render LaTeX to PDF or any visual format, does not handle arbitrary LaTeX text or document structure, does not execute the resulting Chelis program, and does not translate Chelis back into LaTeX. Verifying the resulting program against properties is a separate Chelis step downstream.

Each construct below produces a clean error. Fix it at the source before translating.

Macro expansion is out of scope. Pre-expand macros with a tool such as latexpand or de-macro, or your editor's macro expansion, then translate the expanded LaTeX.

The & row separator is unhandled. The \begin{align} shell parses but each & raises an unrecognized-character error. Split the alignment into multiple \begin{equation} blocks.

The prime token is not tokenized as a derivative. Use \frac{df}{dx} or \frac{\partial f}{\partial x} instead.

\dot{x} would denote a time derivative, but there is no way to introduce the implicit time variable. Rewrite as \frac{dx}{dt} with an explicit % chelis: t : f32 annotation. \ddot{x} becomes \frac{d^2 x}{d t^2}. The accent decorators \hat{x}, \bar{x}, and \tilde{x} error as unknown commands; rewrite the accented identifier to a distinct name (for example \hat{y} to y_hat). The purely typographic decorators \vec{x}, \mathbf{x}, and \boldsymbol{x} strip silently.

\in is not a recognized command. Rewrite to the bounded form \sum_{i=1}^{|S|}, materializing the index set up front.

The trailing-plus superscript is not recognized. Write \max(x, 0) directly.

The parser reads \mathbb{P}(...) as conditional probability, so the comma is unexpected. Use \mathbb{P}(A \cap B) if your context defines cap, or split into two probabilities and handle the join in the surrounding Chelis.

\langle is not recognized. Use x \cdot y for the dot product, or rewrite explicitly as \sum_i x_i y_i.

These are not supported as free binary operators. They are permitted only inside indicator-condition position and the \sum lower-bound syntax.

The parser does not surface multi-argument paren calls on a bare identifier. Use \text{Beta}(a, b), which routes through the Beta mapping, or build via \Gamma-based identities.

Octant requires a known closed form and does not ship a closed-form recognizer, so every integral errors. Hand-expand the integral to its closed-form expression and translate that.

Octant's diagnostics follow the form <source>:<line>:<col>: error[<category>]: <message>, followed by a caret-underlined source block and an optional = help: line. The exit code reflects the category.

The LaTeX failed to tokenize or parse. Common cases:

  • Empty input (an empty file, only whitespace, or only % chelis: comments). Add the formula; magic comments alone are not a program.
  • An unterminated { in a \frac numerator or denominator. Close the brace; the caret points at the unclosed {.
  • An empty {} where a body is required, for example \frac{}{b}. Provide a body.
  • Mismatched \left and \right, for example \left( x \right]. Match the closer to the opener.
  • A stray \right with no matching \left. Remove the \right or add the \left.
  • An unterminated ( on a bare identifier, for example B(a, b). Use the backslash-prefixed function form.
  • An unclosed paren after a function call, for example \sin(x. Close the parenthesis.
  • A \sqrt with no radicand. Add the brace argument, \sqrt{x}.
  • An unrecognized character (&, ', a non-ASCII letter that is not a Greek-letter command). Rewrite using supported syntax.
  • A malformed magic comment, for example a stray : in r ::: f64 or an unknown primitive type. Use the <names> : <type> form with a recognized primitive.

Type inference rejected the program. Common cases:

  • An unbound identifier: a free identifier with no % chelis: annotation, that is not a known constant, and is not bound by a sum or product. Add the annotation. The message includes the suggested form. Subscripted identifiers flatten, so x_i needs % chelis: x_i : f32; annotating bare x does not satisfy x_i.
  • A type mismatch: two operands with incompatible types, for example a bool mixed with numeric arithmetic. Fix the annotation, or keep the bool and numeric values apart. Indicators are the standard way to turn a predicate into a numeric value.
  • A custom symbol not in scope, for example \mathbb{P}(a | b) with no import bringing cond_probability into scope. Add the import.

Octant does not enforce builtin function arity. It maps the LaTeX name to its Chelis target without claiming a signature; the Chelis compiler resolves the arity at build time. So \max(x) with one argument translates without error, and the mismatch surfaces as a Chelis-side diagnostic, with the spans manifest still pointing back to the LaTeX.

A LaTeX construct outside the supported subset. These are the constructs listed above: custom macros, integrals, ambiguous or unbounded sum bounds, non-math environments, and unknown commands. The message names the construct and, for unknown commands, suggests checking the supported subset or registering a mapping with --config.

A filesystem or stdio failure: an input file that does not exist or is not readable, or a --config file that could not be opened. Check the path. Use - for stdin.

The input bytes are not valid UTF-8, or an unsupported encoding was requested through --input-encoding. Octant reads UTF-8 only. Convert the input first, for example with iconv, then translate without the encoding flag.