Unit-safe serialization
for science and industry.
Every value carries its width, base, and physical unit inline — no schema, just
human-readable text. A bare 9.81 is never ambiguous, and a mismatched
unit is a parse error.
One format, end to end — config in, decoded values out.
You saw the syntax — here's a spacecraft running on it. One format, the whole loop:
config in, telemetry out. Edit the orbit; the craft encodes each measurement into a
.bvnr frame and the ground station decodes it — the orbit you see is drawn only from those
decoded values, a full round-trip through the format. Units, bit-widths, and types ride
inside the stream; no schema required. Hover any gauge to light up the line it was decoded from.
Every frame is parsed by the C reference implementation itself, compiled to WebAssembly
and running live in your browser — the exact bvnr_read() that ships in the native library,
not a JavaScript re-implementation. The same engine drives all three demos and the
playground below.
How it works — the full round-trip
- The config on the left isn't a form — it's a real
.bvnrdocument you can edit freely. Nothing changes until you press Apply. - When you do, it's read straight from the text. If something doesn't make sense, you get a friendly error pointing at the line, and the live view keeps running on the last good config — a bad edit can't break it.
- Those values set the scene, and the demo takes it from there.
- From then on, every reading is written out and read back as
.bvnr, the same format you just edited — units and types travel right alongside the numbers. - So the gauges and charts show only what came back through the format, never a number taken on faith. Flip on the noise and you can watch it shrug off a garbled frame.
- Hover any gauge to light up the exact line it was read from.
edit→parse→simulate→encode→(corrupt?)→parse→display
The real event stream.
This is the reference C reader's on_verified callback stream, running live in your browser —
the unmodified C core compiled to WebAssembly, not a JavaScript re-implementation. The same events, in the
same order, that bvnr_read() delivers. Bare values get the
validator's synthesised default annotation; type, range, base, and unit violations surface on the
separate on_error channel, exactly as the C core reports them.
The context travels with the number.
In science and industry the costly failures are rarely bad syntax — they are unit confusion:
pounds-force read as newtons, feet as meters. The number parses fine; the
9.81 is right but the context is
wrong. Bovnar keeps that context — width, base, and unit — inline with every value, as
plain human-readable text with no external schema, and rejects a mismatched unit as a parse
error rather than a silent bug.
uint:16 stays exactly 16 bits: it can't silently widen to 64, or be reinterpreted as a float.11001010 is never mistaken for a decimal value. Values whose digits include letters (e.g. hex ff) are written as quoted strings: <uint:_16> "ff".s⁻²) or a plain-ASCII caret (s^-2) interchangeably.s⁻², m²) and an all-ASCII form that uses a caret for the
exponent and * in place of the · separator. k~g*m*s^-2 and
k~g·m·s⁻² parse to exactly the same unit. The ASCII form needs no obscure glyphs, so it's the
natural choice for hand-authoring .bvnr. The writer emits Unicode superscripts by default, or
the caret form when you set BVN_UNIT_ASCII_EXP.
All of it is optional: omit annotations for well-defined defaults (uint:64,
float:64), or add them for full parser validation. Both modes are unambiguous —
and a .bvnr file stays plain UTF-8 text you can read in any editor, no toolchain required.
The grammar of precision.
Every assignment is a declaration: the annotation is part of the value, not a note about it.
Built for exactness.
uint, sint,
and float a numeric base. Defaults are defined, not guessed. Annotate when precision
matters; omit when it doesn't.
on_unverified / on_verified callback pair.
No heap allocation during parsing itself.
NumPy bridge that loads typed arrays
straight into an ndarray with the physical unit attached.
Up in minutes.
bvnr_read_flags_t. Both callbacks receive the event type and parsed data.loads / dumps interface. Pure-ctypes — no compiled extension required.loads(typed=True) wraps each typed value in a Quantity that preserves its exact text, bit-width, and unit. Pass the dict directly back to dumps() for a lossless round-trip.numpy.ndarray — Bovnar widths map to native dtypes (float:32 → float32) and the whole-array unit rides alongside. NumPy is an optional, lazily imported extra (pip install "bovnar[numpy]").libm.bovnar bench.When a wrong unit is a failure.
Reach for Bovnar when units must travel with the data and the receiver may not share a schema. Every measurement is unit-safe by construction — a mismatched unit is a parse error, not a silent bug discovered in production.
Readings stay self-describing from the lab bench to the published dataset — width, base, and physical unit ride along with every value.
Pressures, flows, and temperatures cross process boundaries without a shared contract, and dimensional mismatches are caught at the parse step.
Heterogeneous devices emit human-readable, type-precise records that any consumer can validate on its own, no central registry required.
Data written today still means exactly the same thing decades from now — the meaning lives in the file, not in lost tooling.
Everything you need to ship.
Thirteen documents — from a five-minute tutorial to the formal EBNF grammar and conformance protocol. Read inline below, browse them as standalone pages, or download the full set as PDF.
loads/dumps and streaming Reader/Writer.Take the documentation offline
Print-ready, self-contained PDFs of every document — or grab the complete set as one archive.
↓ Download all- 01 Tutorial PDF
- 02 FAQ PDF
- 03 Specification PDF
- 04 Units & Currencies Cheat Sheet PDF
- 05 Unit & Currency Reference PDF
- 06 Unit Policy PDF
- 07 Unit Ambiguities PDF
- 08 Read & Write API PDF
- 09 Python Bindings PDF
- 10 Streaming, Framing & Multiplexing PDF
- 11 Unit Profiles PDF
- 12 Formal EBNF Grammar PDF
- 13 Conformance Test Tool PDF