dmog

Translate a document between data formats

dmog reads a document in one data format and writes it in another: CSV as YAML, YAML as TOML, an ABNF grammar as GBNF. It writes as it reads, so a large document starts to come out before the end of it goes in. It also runs programs in the alchemy language over a document, to reshape it on the way.

Take the tutorial Install dmog

dmog 0.4.0 · MIT licensed · github.com/tabnas/dmog

Here dmog reads a YAML file and writes it as TOML:

$ cat server.yaml
server:
  host: example.com
  port: 8080
  tls: true
paths:
  - /api
  - /health
$ dmog translate --from yaml --to toml server.yaml
"server" = { "host" = "example.com", "port" = 8080, "tls" = true }
"paths" = [ "/api", "/health" ]

The output is the same document in another format. Every format dmog reads, it also writes, and the formats reference lists what each one keeps.

Install #

dmog is one command with three builds. Each needs its own runtime:

Runtime Command
Node.js 24 or later npm install -g @tabnas/dmog
Go go install github.com/tabnas/dmog/go/cmd/dmog@latest
Rust 1.85 or later cargo install tabnas-dmog

For more information, see Install dmog.

Call it from a program #

Each build's package is also a library, which a program can call to translate a document or run a program without starting the command. See Use the TypeScript library, Use the Go library, or Use the Rust library.

The documentation #

The documentation is in four parts:

  • Tutorials. Lessons that take you from nothing to a working translation, and to a first program.
  • How-to guides. Recipes for one task each, such as translating part of a document, reading a failure in a script, or calling dmog from a program.
  • Reference. The commands, their options, every format, every failure, and the libraries, stated in full.
  • Explanation. How dmog is put together, and why it streams.