Automatic generation from OCaml
To ensure that the documentation is and stays exhaustive, we could move the documentation strings to the OCaml code as a big pattern-matching of type primitive -> string
or maybe (_, _) instr -> string
and use it to generate the reference documentation.
Some open questions:
- Should this be part of the protocol? It is possible to have this function outside of the protocol, for example in the client, but maybe we want it to be part of the protocol anyway.
- How much structure do we want to enforce on the OCaml side?
- Can we generate the typing rules? Or at least check them?
- Same question for the flags on types.
- Should this work on primitives or on the GADT? The GADT is aware of all the overloaded variants but some primitives are not reflected there at all (CAST, RENAME, and UNIT).