asciichemAsciiChem
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.
asciichem-tsasciichem-pyAsciiChem 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.
One model, three implementations
Section titled “One model, three implementations”Three independent packages — asciichem (Ruby), asciichem-ts (TypeScript),
and asciichem-py (Python) — implement the same model and pass the same
shared corpus byte-for-byte.
Pick whichever ships in your stack:
| Implementation | parse / reject | L0 | L1 | L2 | SMILES | molfile | CML | linter |
|---|---|---|---|---|---|---|---|---|
| Rubyasciichem gem · reference | claimed | claimed | claimed | claimed | claimed | claimed | claimed | claimed |
| TypeScriptasciichem · npm | claimed | claimed | claimed | claimed | claimed | claimed | not yet claimed | not yet claimed |
| Pythonasciichem-py | claimed | claimed | claimed | claimed | claimed | claimed | not yet claimed | not yet claimed |
Filled cells are claimed at 100% of the asciichem-tests corpus, verified in each implementation's CI. The Ruby gem is the reference; a claim is only as good as the shared corpus behind it.
Why three
Section titled “Why three”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. Three implementations keep the contract honest — no single implementation’s shortcuts become the specification.
Pick one and start
Section titled “Pick one and start”Ruby (reference)
gem install asciichem — the reference implementation. MathML,
structural SVG, citations, InChI identity. See
Ruby.
TypeScript
npm install asciichem — runs in the browser or Node. Powers this
page’s live renderer. See TypeScript.
Python
pip install asciichem-py — plain dataclasses, zero runtime
dependencies. See Python.