[ANN] ATD 4.1.0 - now with YAML support

ATD now has OCaml support for conveniently reading data from YAML files as well as from other formats with minimal effort. It means:

  1. You define a type for your config data.
  2. atdml --mode jsonlike app_config.atd generates the OCaml code that converts a JSON-like AST containing source locations into your config data structure.
  3. Your program loads a YAML file, converts it to a JSON-like tree, and then calls the generated function to translate it into an OCaml data structure.
  4. Your application prints useful error messages if the config is malformed or incomplete.

An example is included in the distribution. It uses the recently released YAMLx library.

Note that YAMLx needs generous sponsors to fund the work that was done and unlock a permissive ISC license for everyone. Or you can accept the terms of the AGPL license if you’re happy to share your application’s source code with the users.

Other input file formats or other YAML libraries can be used similarly with minimum effort as long as source locations are available. For this, you’ll need a bridge that converts your AST into the JSON-like AST.

6 Likes