ott-lang/ott

Ott support for JSON?

martinberger opened this issue · 1 comments

JSON has emerged as a standard format for data types serialisation, and most programming languages now have strong JSON support. For example Ocaml can auto-generate JSON pretty-printers and parsers for data types using yojson or adt. Both tools require compile-time meta-programming (e.g. in the form of @@deriving) for auto-generation of suitable pretty-printers and parsers.

How hard would it be to add support for automatic generation of support for JSON to OCaml types? Given that Ott has full control over the output, I imagine that it could be straightforward, with the possible exception of cases where the autogenerated code needs to be overridden with existing pretty-printers or parsers. (I'm asking because I want to JSON-ify Jib (the Sail IR) and I'm struggling to do this in a principled way. A similar question could be asked about Lem, but Jib is specified in Ott.)