Skip to content

What's new

The v0.2x line turns AsciiChem from a parser into a chemistry platform: external structures flow in, identities resolve, and independent implementations pass the same corpus. The current order is the November 2026 directive below: Rust is authoritative, and one parse engine runs everywhere.

Rust is the authoritative implementation (November 2026)

The architecture directive, landed: asciichem-rs is the authoritative implementation — all runtimes carry identical functionality, and where a port is pending (the TypeScript and Python resolver/citation/linter convergence, ts#26/py#19) the matrix says so. rs completed the surface slice: L3 stereo (rs#17), SMILES + molfile interchange (rs#19), in-process InChI identity through chemomer (rs#18), the thirteen-check linter (rs#20), the resolver — PubChem default, OPSIN, Common Chemistry with the key chain, TTL cache, provenance, per-source isolation (rs#21) — citation bibitems and CML built on the leptris XML engine (rs#22, rs#23), and the asciichem CLI binary (rs#25). See Rust.

One parse engine everywhere (November 2026)

The parslet/peggy/rd era is over. Every runtime now parses through the parsanol family over one checksummed PARG artifact (grammar v0.4.0, sha256 b5c1f528…): Rust embeds it (parsanol-rs), Ruby runs the PARG artifact engine (0.31.16 — the parslet parser, the engine selector, the --engine flag, and the parslet gem dependency are deleted; asciichem-ruby#161), TypeScript parses on the parsanol wasm build (0.1.4 — peggy deleted; asciichem-ts#27), Python through parsanol-python (0.1.2 — rd deleted; asciichem-py#20). Performance, honestly: peggy was faster per-parse; the directive is unification over speed, and the named follow-up is the parsanol-eval optimization. See the syntax contract.

Structure interchange

SMILES and molfile (V2000) ingest into the semantic model — the same tree the AsciiChem syntax produces — so database chemistry renders, lints, and serialises unchanged. Deterministic SMILES re-emission round-trips aspirin exactly. See Structures and resolution.

Resolution with provenance

AsciiChem::Resolver turns identifiers into substance records — multi-source, cross-checked, cached in the user cache dir, with per-identifier provenance. PubChem, OPSIN, and CAS Common Chemistry resolve by default; documents limit the set with asciichem-sources. CLI: asciichem resolve --cas 50-78-2.

Three implementations, one contract

Historical (the v0.2x line). TypeScript (asciichem) and Python (asciichem) joined the Ruby gem, all passing the same shared corpus — the single-contract rule. The set is four today, with Rust authoritative. See Implementations.

Local identity: the InChI engine

Derive InChI/InChIKey from the drawn structure, offline — the IUPAC inchi-1 binary or the native Rust engine behind an opt-in engine, never a reimplementation. @inchi annotations are cross-checked against what you actually drew. CLI: asciichem identity -i ... --from smiles. See Local identity.

MathML parity, byte for byte

The corpus grew an L2 level: MathML goldens from the reference implementation, compared as exact strings. All three implementations — Ruby, TypeScript, Python — now emit identical MathML; the playground shows it live. Stereo markers survive the wire form. Embedded math crosses through the mml contract model — typed parse and framework re-serialize, not xpath surgery.

Shareable playground links

The live renderer writes its state into the URL fragment (#code=…&lang=…&mode=…). Open a playground link and land on the same expression, language, and output mode.

Chemistry in Metanorma documents

The metanorma-plugin-asciichem gem closes the document loop: [chem] blocks render as MathML formulas in any Metanorma flavour, and @cite-annotated molecules resolve into dataset-type bibliography entries — one per (source, substance), anchored by InChIKey — collected automatically into the References section. See Chemistry in Metanorma.

Opt-in Rust-core parsing engine (0.29.0) — superseded

Historical (2026; superseded by the November 2026 unification above — parslet is deleted and the PARG artifact engine is the one engine). The same grammar and transform ran over Parsanol’s Rust-backed parslet-compat layer: AsciiChem::Engine.use(:parsanol) or asciichem convert --engine parsanol — the full corpus passed identically under either engine (221/221 re-verified against parsanol 1.3.27, all four reported upstream issues fixed), at ~2.6× parse speed. Parslet stayed the default; parsanol was an opt-in soft dependency.

The contract is not a package

asciichem-model is now a pure contract repository: LUTAML definitions, v1 schemas, generated types. Implementations vendor from tags; nothing depends on a gem. See The wire form.

Stereo end to end (L3)

Tetrahedral chirality (@/@@) and directional E/Z bonds are model data through text, SMILES, and wire; canonical SMILES emits parity-correct tokens including ring closures, and chirality crosses into InChI as MDL atom parity. See the levels spec.

Reactions as semantics (0.31.x)

Typed condition roles ([cat: Pd; solv: THF]), Reaction#stoichiometry as model data feeding the balance check, a derived mechanism step graph (catalysts, inter-step links, and electron-flow markers), and RInChI keys through the opt-in engine. See Reaction conditions and Mechanism.

The perception pass

One shared chemistry-perception layer — implicit hydrogens that decline rather than invent, and Hückel aromaticity counting (furan, pyrrole, and thiophene perceived from Kekulé bond orders) — conformance-tested through the corpus so every implementation derives the same values. The linter consumes it; the canonicalizer requires it. See Perception.

Canonical aromatic SMILES

The SMILES writer now consumes the perception pass: Kekulé input canonicalizes to the lowercase aromatic form ([nH] for pyrrole nitrogen), deterministically, with corpus fixtures pinning the exact output. See Canonical form.

The identity loop, closed

OPSIN resolves IUPAC names to structures, identifier cross-checks compare sources, and citations resolve per (substance, source) — with every shipped source on by default (PubChem, OPSIN, CAS Common Chemistry), attribution carried into every record and bibitem, and document-level limiting via asciichem-sources for NC-free needs. See Citing substances.

Native InChI, no binary at runtime

The Rust engine derives the full standard identifier — canonical numbering, mobile-H groups, stereo layers, and the InChIKey with a dependency-free SHA-256 — gated 1559/1559 against the recorded oracle corpus. It ships as a Rust library, a C ABI, and Python/WASM/Node bindings; the Ruby gem reaches it through AsciiChem::Inchi::NativeEngine. See Local identity.

Four implementations, every gated level

The Rust core completes the set: wire, canonical text, MathML goldens, and SVG byte-exact across renderers — and Python’s SVG matches TypeScript byte for byte. Every implementation holds L0 through L3, and CI consumes the corpus and model schemas pinned to released tags. See Implementations.

v0.2 foundations

Reaction cascades, the linter framework, stereochemistry prefixes, all bond kinds, Greek letters, fuzzing and benchmarks — see the syntax pages.

Implementationparse / rejectL0L1L2SMILESInChImolfileCMLlinter
Rustasciichem · crates.io (authoritative)claimedclaimedclaimedclaimedclaimedclaimedclaimedclaimedclaimed
Rubyasciichem · RubyGemsclaimedclaimedclaimedclaimedclaimedclaimedclaimedclaimedclaimed
TypeScriptasciichem · npmclaimedclaimedclaimedclaimedclaimedclaimedclaimednot yet claimednot yet claimed
Pythonasciichem · PyPIclaimedclaimedclaimedclaimedclaimedclaimedclaimednot yet claimednot yet claimed

Filled cells are claimed at 100% of the asciichem-tests corpus, verified in each implementation's CI. Rust is the authoritative implementation — the reference the other runtimes converge on; the shared corpus keeps them identical. Every runtime parses through the same engine: parsanol over the one checksummed PARG artifact of the grammar. The InChI column is the identity gate: each runtime derives InChI for the recorded fixtures and must agree with the oracle recording leg (three-leg discipline — engine, gem molfile, oracle). Where a port is genuinely pending (the TypeScript and Python resolver, citation, and linter layers — asciichem-ts#26, asciichem-py#19), the cell stays open until its CI gate is green.

Play