---
title: "mlab-parser — Mova code model"
description: "Mova code model of mlab/src/parser.rs: components with their labels, obernants and the model text."
url: "https://groupants.elamur.ai/free/en/mova/mlab/src/parser.rs.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/mlab/src/parser.rs.groupant/>

# mlab-parser

The groupant beside mlab/src/parser.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
- **status:** partial source bound model
- **source:** [`mlab/src/parser.rs`](https://github.com/ElamurAI/mova-free/blob/main/mlab/src/parser.rs)
- **source SHA-256:** `264bd8e53dd79007…`
- **repository folder:** [`mlab/src/parser.rs.groupant`](https://github.com/ElamurAI/mova-free/tree/main/mlab/src/parser.rs.groupant)
- **repository commit:** `855da7bd4a7b`

> **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 | [composition](#composition) |
| **cost** | symbolic source derived | [invariant](#invariant) |
| **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) |
| `representation_transport` | representation_transport | partial source derived model | [representation_transport](#representation-transport) |
| `failure_precedence` | failure_precedence | partial source derived model | [failure_precedence](#failure-precedence) |
| `resource_domain` | resource_domain | partial source derived model | [resource_domain](#resource-domain) |
| `interaction_relation` | interaction_relation | partial source derived model | [interaction_relation](#interaction-relation) |

## Parts

- [mlab-parser-expression-precedence](https://md.groupants.elamur.ai/free/en/mova/mlab/src/parser.rs.groupant/expression-precedence.groupant/)

## Model text


### descriptant

#### Recursive precedence and statement parser

parse_program lexes then descends statements. Functions partition into Program.functions. LHS probing restores position when no assignment follows. Power is left-associated: 2^3^2 maps Pow(Pow(2,3),2); unary wraps power: -2^2 maps Neg(Pow(2,2)). Matrix whitespace before unspaced sign starts a new element; end is special only with positive index_depth.

##### Modeling epoch 2026-10-31

Prospective source reading precedes test additions. Retained observations: lexer space_before and Newline feed matrix and statement boundaries; AST tags are consumed by interp/vm. end resolution belongs to interpreter index context, not a parser numeric substitution; n-dimensional shape checks remain downstream.

This is partial source-derived modeling, not proof, full semantic coverage, or a performance result. Public malformed representations, unbounded allocations and exhaustive numerical edge cases remain outside the checked fixtures.

### approximant

#### Recursive precedence and statement parser forward relation

parse_program lexes then descends statements. Functions partition into Program.functions. LHS probing restores position when no assignment follows. Power is left-associated: 2^3^2 maps Pow(Pow(2,3),2); unary wraps power: -2^2 maps Neg(Pow(2,2)). Matrix whitespace before unspaced sign starts a new element; end is special only with positive index_depth.

Domain: Lexer-accepted token stream; recursive stack/allocation resources. No external files/evaluation. Function bodies may terminate at EOF/next function; ordinary blocks require matching terminator.

No executable Rust surrogate is supplied: categorical decisions require exact observations; numerical kernels have no measured approximation metric here. Future supported caps are 1%, 2%, 5%, 10% only.

### invariant

#### Invariant and cost

Ordered statement bodies, explicit Paren nodes, optional range step and index arguments survive parsing. Empty input gives empty Program. Anonymous body resets index_depth and restores matrix context only on successful descent; failed parser state is discarded by parse_program.

Cost: O(T) ordinary descent plus speculative LHS parse/reparse; deeply nested indexed LHS probes can add repeated subexpression work, so no uniform linear proof. O(T) retained AST plus recursion depth; no nesting cap.

Failure ordering: Whole lexing precedes syntax errors. Statement keyword/command/increment dispatch precedes LHS probing then expression fallback. Missing block terminator reports first expected term; unsupported global/persistent fails before runtime.

### composition

#### Parent composition

lexer space_before and Newline feed matrix and statement boundaries; AST tags are consumed by interp/vm. end resolution belongs to interpreter index context, not a parser numeric substitution; n-dimensional shape checks remain downstream.

Scoped fragments are projections over exact byte intervals in this source; they share one parent syntax projection. Uncovered declarations and embedded checks remain parent modeled. Whole lexing precedes syntax errors. Statement keyword/command/increment dispatch precedes LHS probing then expression fallback. Missing block terminator reports first expected term; unsupported global/persistent fails before runtime.

The relation is source-derived and finite checks cannot establish complete correctness or a composition-wide numerical error bound.

### models

### behavior_complement

The accepted parse relation excludes right-associated 2^3^2, flattening [1 -2] to subtraction, accepting naked end as expression, or returning a partially built Program on Result::Err. It does not exclude semantically invalid break, unknown function, public invalid AST or runtime division by zero.

### reverse_reconstruction

P^-1(tree) contains texts sharing AST tags/literals and retained statement line/print flags; comments and many separators are ambiguous. For Pow(Pow(2,3),2), 2^3^2 is compatible; 2^(3^2) differs through Paren and tree shape. An evaluated scalar has much larger fibers.

### representation_transport

Ordered statement bodies, explicit Paren nodes, optional range step and index arguments survive parsing. Empty input gives empty Program. Anonymous body resets index_depth and restores matrix context only on successful descent; failed parser state is discarded by parse_program.

### failure_precedence

Whole lexing precedes syntax errors. Statement keyword/command/increment dispatch precedes LHS probing then expression fallback. Missing block terminator reports first expected term; unsupported global/persistent fails before runtime.

### resource_domain

Lexer-accepted token stream; recursive stack/allocation resources. No external files/evaluation. Function bodies may terminate at EOF/next function; ordinary blocks require matching terminator.

### interaction_relation

lexer space_before and Newline feed matrix and statement boundaries; AST tags are consumed by interp/vm. end resolution belongs to interpreter index context, not a parser numeric substitution; n-dimensional shape checks remain downstream.


### tests

#### Source-specific bounded evidence

`parser::wave30::precedence`: left power association, unary precedence, matrix whitespace, End context, missing block terminator, empty program.

Seven named tests each passed twice debug and twice release on 2026-10-31, with actual named log lines sorted and identical across all four runs (28 selected successful executions). Each source has a compiled changed-assertion negative control; six runtime sources additionally have compiled production-body mutants that fail those unchanged tests. AST has representation evidence only. Every mutant is byte-restored and its positive test rerun. See `evidence.json` for this source's exact hash, mutation and exit statuses. External receipts retain full logs, command metadata, control records and prospective notes.

Unexecuted here: No exhaustive statement/function/control grammar. No corpus, GPU, live filesystem, timer or callback run. No broad Clippy claim; dependency/style checks were not repeated. Only appended test blocks were rustfmt-formatted; original production bytes are unchanged.
