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

# latex-lex-stage0

The groupant beside latex/src/lex.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:** [`latex/src/lex.rs`](https://github.com/ElamurAI/mova-free/blob/main/latex/src/lex.rs)
- **source SHA-256:** `65c9e2c47772827a…`
- **covers:** lex scans UTF-8 bytes and appends tokens. Backslash+ASCII letters forms one borrowed Cmd and consumes following ASCII whitespace. Backslash+nonletter consumes one scalar as command; final backslash becomes Char. Percent skips through bytes before LF. Whitespace/tilde emits Space only if output's last token is not Space. Stream::new reverses the resulting vector. (bytes 1350–4763)
- **part of:** [latex-lex](https://md.groupants.elamur.ai/free/en/mova/latex/src/lex.rs.groupant/)
- **repository folder:** [`latex/src/lex.rs.groupant/stage0.groupant`](https://github.com/ElamurAI/mova-free/tree/main/latex/src/lex.rs.groupant/stage0.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) |
| **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) |
| `byte_offset_transport` | byte_offset_transport | partial source derived model | [byte_offset_transport](#byte-offset-transport) |
| `word_symbol_boundary` | word_symbol_boundary | partial source derived model | [word_symbol_boundary](#word-symbol-boundary) |

## Model text


### descriptant

#### latex-lex-stage0

lex scans UTF-8 bytes and appends tokens. Backslash+ASCII letters forms one borrowed Cmd and consumes following ASCII whitespace. Backslash+nonletter consumes one scalar as command; final backslash becomes Char. Percent skips through bytes before LF. Whitespace/tilde emits Space only if output's last token is not Space. Stream::new reverses the resulting vector.

Epoch 2026-10-31: replaced stage topic lists with concrete transitions, exclusions and compatible antecedents. Four meaningful typed views replace the previous six-view bookkeeping catalog. Shared syntax and source byte bounds are unchanged.

### approximant

#### Scoped forward relation

lex scans UTF-8 bytes and appends tokens. Backslash+ASCII letters forms one borrowed Cmd and consumes following ASCII whitespace. Backslash+nonletter consumes one scalar as command; final backslash becomes Char. Percent skips through bytes before LF. Whitespace/tilde emits Space only if output's last token is not Space. Stream::new reverses the resulting vector.

This is an exact source-derived partial model, not an executable approximate replacement.

### invariant

#### Scoped invariants

Unicode command letters cannot extend an ASCII control word. No error Result or file effect is produced. A comment's terminating LF is not consumed by the comment branch and may yield Space; appending to an existing Space cannot emit a duplicate adjacent Space.

pos=base+i as u32; valid nonoverflowing coordinate domain requires offsets and additions to fit. α occupies2 bytes, so scalar index cannot replace i.

Control words consume only ASCII letters; control symbols consume one UTF-8 scalar. #1..#9 map to Param, while #0 and #x retain Char('#') plus following character.

### composition

#### Scoped interaction

Stream reverse storage makes the last vector element the next token; later push-front operations rely on the same reversal convention.

The manifest binds this stage to the unchanged parent syntax projection and exact source byte range. Parent cost remains an upper accounting context; no independent whole-file invocation or execution count is assigned to this fragment.

### models

### behavior_complement

Unicode command letters cannot extend an ASCII control word. No error Result or file effect is produced. A comment's terminating LF is not consumed by the comment branch and may yield Space; appending to an existing Space cannot emit a duplicate adjacent Space.

### reverse_reconstruction

Token preimages lose comments and eaten control-word whitespace: backslash-alpha followed by one or several ASCII spaces before x yields the same kinds. Position observations additionally constrain byte lengths before each token but do not recover comment text. Initial output state changes whitespace coalescing.

### byte_offset_transport

pos=base+i as u32; valid nonoverflowing coordinate domain requires offsets and additions to fit. α occupies2 bytes, so scalar index cannot replace i.

### word_symbol_boundary

Control words consume only ASCII letters; control symbols consume one UTF-8 scalar. #1..#9 map to Param, while #0 and #x retain Char('#') plus following character.

### tests

#### Evidence — 2026-10-31

lex::tests::lexes_commands_and_spaces; lex::tests::positions_are_bytes; lex::tests::render_is_stable

Selected library filters ast:: lex:: macros:: parse:: print:: table:: and integration gate excluding document_extraction_with_preamble_macros and random_token_soup_never_panics_and_roundtrips. Direct rustc --test latex/build.rs exercises private helpers. All selected tests twice debug/release with identical sorted names. Four compiled mutants at build/AST/parser/printer boundaries fail assertions then exact restoration passes. These do not individually cover every source. Build-main failure effects, allocation failures and universal roundtrip are unproved. Strict Clippy reports existing lints. No corpus/live VMM/API/GPU/full-school/held-out tests.
