---
title: "math-calc-parser — Mova code model"
description: "Mova code model of math/src/calc.rs: components with their labels, obernants and the model text."
url: "https://groupants.elamur.ai/free/en/mova/math/src/calc.rs.groupant/parser.groupant/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Research](https://md.research.elamur.ai/free/en/) · **Groupants**

This page as HTML: <https://groupants.elamur.ai/free/en/mova/math/src/calc.rs.groupant/parser.groupant/>

# math-calc-parser

The groupant beside math/src/calc.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.

## Facts

- **kind:** groupant_fragment
- **status:** partial source bound model
- **source:** [`math/src/calc.rs`](https://github.com/ElamurAI/mova-free/blob/main/math/src/calc.rs)
- **source SHA-256:** `81be7f264f451792…`
- **covers:** lex/P normalize aliases, implicit multiplication and precedence; power associates right. Comparison chains expand at most two comparisons. parse_equation extracts top equality or appends0. Preimages include whitespace/aliases, no raw-byte inversion. O(B) token storage, uncapped nesting. (bytes 6098–17753)
- **part of:** [math-calc](https://md.groupants.elamur.ai/free/en/mova/math/src/calc.rs.groupant/)
- **repository folder:** [`math/src/calc.rs.groupant/parser.groupant`](https://github.com/ElamurAI/mova-free/tree/main/math/src/calc.rs.groupant/parser.groupant)
- **repository commit:** `48f2e6f74146`

> **Implementation material.** A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.

## Components

| component | label | where |
|---|---|---|
| **approximant** | partial | [approximant](#approximant) |
| **ast** | partial | `../syntax.json` |
| **composition** | partial | `model.md` |
| **cost** | partial | [Cost](#cost) |
| **descriptant** | present | [descriptant](#descriptant) |
| **invariant** | partial | [invariant](#invariant) |
| **tests** | executed bounded checks | [tests](#tests) |

## Obernants

The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.

| id | type | label | where |
|---|---|---|---|
| `behavior_complement` | behavior_complement | partial source derived model | [behavior_complement](#behavior-complement) |
| `reverse_reconstruction` | reverse_reconstruction | partial source derived model | [reverse_reconstruction](#reverse-reconstruction) |
| `binding_precedence` | binding_precedence | partial source derived model | [binding_precedence](#binding-precedence) |
| `comparison_expansion` | comparison_expansion | partial source derived model | [comparison_expansion](#comparison-expansion) |
| `equation_projection` | equation_projection | partial source derived model | [equation_projection](#equation-projection) |
| `lexical_failure` | lexical_failure | partial source derived model | [lexical_failure](#lexical-failure) |

## Parts

- [math-calc-parser-lex-normalization](https://md.groupants.elamur.ai/free/en/mova/math/src/calc.rs.groupant/parser.groupant/lex-normalization.groupant/)
- [math-calc-parser-power-association](https://md.groupants.elamur.ai/free/en/mova/math/src/calc.rs.groupant/parser.groupant/power-association.groupant/)

## Model text


### descriptant

#### math-calc-parser

lex/P normalize aliases, implicit multiplication and precedence; power associates right. Comparison chains expand at most two comparisons. parse_equation extracts top equality or appends0. Preimages include whitespace/aliases, no raw-byte inversion. O(B) token storage, uncapped nesting.

Epoch 2026-10-31: complete source read, parent AST reused; partial finite evidence only.

### approximant

#### Scoped forward and cost

lex/P normalize aliases, implicit multiplication and precedence; power associates right. Comparison chains expand at most two comparisons. parse_equation extracts top equality or appends0. Preimages include whitespace/aliases, no raw-byte inversion. O(B) token storage, uncapped nesting.

No executable percent surrogate claimed.

### invariant

#### Scoped invariant

lex/P normalize aliases, implicit multiplication and precedence; power associates right. Comparison chains expand at most two comparisons. parse_equation extracts top equality or appends0. Preimages include whitespace/aliases, no raw-byte inversion. O(B) token storage, uncapped nesting.

Source range[6098,17753) bound by manifest digest. Parent domain applies, not arbitrary public states.

### models

## Source-scoped typed relations

### behavior_complement

parse('2^3^2') excludes left-associated (2^3)^2; successful parse excludes unconsumed tokens. Unknown identifiers followed by parentheses exclude Call unless name is recognized.

### reverse_reconstruction

A canonical Call('binom',...) admits C/choose/nCr/binomial/binom spellings; equivalent whitespace and normalized multiplication symbols are lost. Output E does not recover original bytes.

### binding_precedence

pow consumes unary exponent recursively: 2^-1 works and -2^2 becomes Neg(Pow(2,2)). Postfix factorial/index binds before power.

### comparison_expansion

a<b<c becomes And(Lt(a,b.clone),Lt(b,c)); parser supports at most this second comparison, so a fourth comparison leaves tokens and errors.

### equation_projection

parse_equation unwraps only root Eq; every other accepted E maps to(E,0). An And chain involving equality remains an expression against zero.

### lexical_failure

Character scan recognizes exponent digits only when e/E is followed by valid signed/unsigned digits. Unknown symbol errors before parsing; malformed number text fails parse_q during primary.

### tests

#### Evidence

See ../tests.md for actual checks and source mutant; this fragment adds no runtime test.

lex/P normalize aliases, implicit multiplication and precedence; power associates right. Comparison chains expand at most two comparisons. parse_equation extracts top equality or appends0. Preimages include whitespace/aliases, no raw-byte inversion. O(B) token storage, uncapped nesting.

### wave34-composition

## Parser descendant composition

The lex-normalization child runs before P exists: lexical Err prevents all parsing. Its canonical token stream feeds or/and/not/comparison/add/mul/unary and the power-association child. Power receives a cursor into that stream, consumes postfix and recursively unary exponents, then returns to the surrounding precedence layer. parse finally rejects unconsumed tokens. The two child ranges overlap the enclosing parser relation but do not exhaust it: function recognition, list parsing, comparison expansion and parse_equation remain modeled by the historical parent.

A compatible parser antecedent must satisfy both lexical spelling equivalence and the cursor/precedence relation; arbitrary lexer and power preimages cannot be paired without the same token stream. Exclusion at the parent includes failure ordering: lexical failure precedes numeric primary validation, which precedes trailing-token rejection when reached.

### Cost

Lexing O(C) plus parser work over tokens; power's recursive depth is part of parser stack use. Do not sum overlapping parent and child token traversal estimates. No nesting or allocation bound is proved.
