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.mliand<prefix>_t.mlcontaining OCaml type definitions for the ATD input πΈ-bβ produce files<prefix>_b.mliand<prefix>_b.mlcontaining OCaml serializers and deserializers for the Biniou data format π¦-jβ produce files<prefix>_j.mliand<prefix>_j.mlcontaining OCaml serializers and deserializers for the JSON data format β¨-vβ produce files<prefix>_v.mliand<prefix>_v.mlcontaining 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,-band-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 printNaNand infinities. this option implies-jsonunless 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_stringfunction 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_handlerfor every unknown JSON field found in the input instead of simply skipping them. the initial value of this reference prints a message and raises aFailureexception. π-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-extendbecause user-written validators depend on the type definitions. π§-extendMODULEβ 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πͺ-openMODULE1,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-fnameFILENAMEβ source file name to use for error messages (default: input name) π-pos-lnumLINENUMβ 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 πβ¨ππ¦
π¦ where this page comes from
- debian bookworm: libatdgen-ocaml-dev 2.10.0-2+b3 Β· BSD-3-Clause
- debian trixie: libatdgen-ocaml-dev 2.16.0-2+b1 Β· BSD-3-Clause
- ubuntu jammy: libatdgen-ocaml-dev 2.2.1-1build2 Β· BSD-3-Clause
- ubuntu noble: libatdgen-ocaml-dev 2.15.0-1 Β· BSD-3-Clause
- ubuntu questing: libatdgen-ocaml-dev 2.16.0-2build2
- ubuntu resolute: libatdgen-ocaml-dev 3.0.1-1build1 Β· BSD-3-Clause
- ubuntu stonking: libatdgen-ocaml-dev 4.2.0-2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms