ATDGEN(1)

✨ atdgen β€” the ATD compiler & code generator bestie πŸ’–

okay so real talk, this is the atdgen(1) manual page from the User Manuals section, and we're about to make it make sense. sit down, hydrate, let's go 🫢


🌸 SYNOPSIS 🌸

atdgen [options...] [atd-file]

πŸ’œ DESCRIPTION πŸ’œ

so atdgen reads your ATD type definitions and generates OCaml code β€” both .ml and .mli files, like a whole matching set, no cap β€” for the following lil guys:

  • type definitions (option -t) πŸ‘‘
  • serializers and deserializers for Biniou (option -b) πŸ¦‹
  • serializers and deserializers for JSON (option -j) ✨
  • record-creating functions supporting default fields (option -v) πŸŽ€
  • user-specified data validators (option -v) βœ…

and listen, if you give it no mode option (-t, -b, -j or -v), it just assumes -t -b. manifesting both, iconic behavior honestly.

unless -o is present, the <prefix> for the generated files is derived from the atd-file argument. and if you omit the atd-file argument entirely? atdgen reads ATD sources from standard input. and if you additionally don't pass -o, it behaves as if you gave it -o -. it's giving "we'll figure it out" πŸ’…


πŸŽ€ OPTIONS πŸŽ€

  • -t β€” produce files <prefix>_t.mli and <prefix>_t.ml containing OCaml type definitions for the ATD input 🌸
  • -b β€” produce files <prefix>_b.mli and <prefix>_b.ml containing OCaml serializers and deserializers for the Biniou data format πŸ¦‹
  • -j β€” produce files <prefix>_j.mli and <prefix>_j.ml containing OCaml serializers and deserializers for the JSON data format ✨
  • -v β€” produce files <prefix>_v.mli and <prefix>_v.ml containing OCaml functions for creating records and validators, see also option -validate. πŸ‘‘
  • -dep β€” output dependencies in makefile-format for all possible atdgen output files, then exit πŸšͺ
  • -list β€” output a space-separated list of all possible atdgen output files, then exit πŸ“
  • -o <prefix> β€” set the <prefix> for the options -t, -b and -j. and if <prefix> is -, atdgen writes code in the form of
struct ... end : sig ... end

straight to standard output. so fancy πŸ’…

  • -biniou β€” [deprecated] same as -t -b, i.e., produce serializers and deserializers for Biniou and OCaml type definitions (this is the default, btw)
  • -json β€” [deprecated] same as -t -j, i.e., produce serializers and deserializers for JSON and OCaml type definitions.
  • -j-std β€” standard JSON: convert tuples and variants into standard JSON and refuse to print NaN and infinities. this option implies -json unless another mode is specified. ⚠️
  • -std-json β€” [deprecated] same as -j-std
  • -j-pp <func> β€” apply the OCaml function <func> of type (string -> string) to the input of each *_of_string function generated by atdgen (JSON mode). (this was intended for UTF-8 validation of the input, which is not performed by atdgen. so don't @ me πŸ™ˆ)
  • -j-defaults β€” output JSON record fields even if their value is known to be the default. no gatekeeping πŸ’–
  • -j-strict-fields β€” call !Ag_util.Json.unknown_field_handler for every unknown JSON field found in the input instead of simply skipping them. the initial value of this reference prints a message and raises a Failure exception. 😭
  • -j-custom-fields <func> β€” call function <func> of type (string -> unit) for every unknown JSON field found in the input instead of simply skipping them. see also -j-strict-fields. πŸ”₯
  • -validate β€” [deprecated] same as -t -v, produce data validators from <ocaml validator="x"> annotations where x is a user-written validator to be applied on a specific node. this is typically used in conjunction with -extend because user-written validators depend on the type definitions. 🧚
  • -extend MODULE β€” assume that all type definitions are provided by the specified module unless otherwise annotated. type aliases are created for each type, e.g. type t = Module.t πŸͺ„
  • -open MODULE1,MODULE2,... β€” list of modules to open (comma-separated or space-separated) πŸšͺ✨
  • -nfd β€” do not dump OCaml function definitions πŸ™…β™€οΈ
  • -ntd β€” do not dump OCaml type definitions πŸ™…β™€οΈ
  • -pos-fname FILENAME β€” source file name to use for error messages (default: input name) πŸ“
  • -pos-lnum LINENUM β€” source line number of the first line of the input (default: 1) πŸ”’
  • -rec β€” keep OCaml type definitions mutually recursive πŸ”
  • -version β€” print version and exit πŸ“¦
  • -help | --help β€” display this list of options πŸ†˜

🌈 SEE ALSO 🌈

  • the Atdgen reference manual, /usr/share/doc/libatdgen-ocaml-dev/atdgen-manual.{html,pdf} πŸ“š
  • the Atdgen tutorial on the Atdgen website, http://mjambon.com/atdgen 🌐

πŸ‘‘ AUTHOR πŸ‘‘

this manual page was written by Sylvain Le Gall <gildor@debian.org> and Hendrik Tews <hendrik@askra.de>, specifically for the Debian project (and may be used by others). absolute legends, fr fr 🫢


and that's the whole page bestie!! this one's from the ATDGEN manual, version vibes of May 2013, ATDGEN(1) β€” go forth and generate that code, you've got this πŸ’–βœ¨πŸŽ€πŸ¦‹