CQCL/hugr

Export a HUGR to an s-expression

zrho opened this issue · 1 comments

zrho commented

For pretty printing HUGRs we would like to convert HUGRs into an s-expression. The s-expressions that are produced by this should be designed in such a way that they can also be read in again in the future, so that they form a human readable and writable encoding of HUGRs.

zrho commented

I have set up the parens crate for parsing and pretty printing s-expressions. There has been some experimentation to figure out a way to make it convenient to implement a data format on top of this. The parser is inspired by Rust implementation of the wasm text format wast, so we have some precedent that this can work at some larger scale. Source span tracking works nicely, so we can get good error messages. The pretty printing uses the pretty crate, which in turn implements Wadler's pretty printing algorithm.