Skip to content

AsciiChem

ASCII in, chemistry out — in your language.

One model · Three implementations · One contract

Type once. The same bytes come out, whichever you ship.

Every implementation passes theshared corpus byte-for-byte — proof the model, not the notation, is the canonical form.

Ruby
asciichem
gem install asciichemReference implementation.
TypeScript
asciichem
npm install asciichemPowers this page.
Python
asciichem
pip install asciichemZero runtime deps.

AsciiChem is an ASCII syntax for representing chemistry — atoms, molecules, bonds, reactions, electron configurations, and the embedded mathematics that chemistry publications rely on. It is to chemistry what AsciiMath is to mathematics, but with a semantic model underneath: every parse produces the same tree, regardless of which front door you came in by.

Four independent implementations — every one published as the package asciichem (on crates.io, RubyGems, npm, and PyPI; the repos are asciichem-rs, asciichem-ruby, asciichem-ts, and asciichem-py, with Rust the authoritative implementation) — implement the same model and pass the same shared corpus. Every one of them parses through the same engine: parsanol over the single checksummed PARG artifact of the grammar — there is no per-language parser left to drift. Pick whichever ships in your stack:

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.

A molecule has one structure regardless of the notation you write it in: InChI, SMILES, molfile, or AsciiChem. Likewise, the AsciiChem model has one shape regardless of the language you run it in. Four implementations keep the contract honest — and the order among them is explicit: asciichem-rs is the authoritative implementation. When the corpus is silent, what the Rust crate does is the operating answer; the shared corpus and the one PARG artifact keep the other runtimes identical to it.

Rust (authoritative)

cargo add asciichem — the authoritative implementation (repo asciichem-rs): parse, canonical text, wire JSON, MathML, SVG, SMILES/molfile, CML, the linter, the resolver, citations (via leptris), in-process InChI identity, and the asciichem CLI. See Rust.

Ruby

gem install asciichem — the full formatter set, citations, InChI identity, the linter, the resolver, and the CLI, on the same PARG artifact engine. See Ruby.

TypeScript

npm install asciichem — runs in the browser or Node. Powers this page’s live renderer. See TypeScript.

Python

pip install asciichem — plain dataclasses for data and science workflows. See Python.

Play