yace generates the bindings of a C API for other languages. You describe the FFI boundary of the API as a C header, in a subset of C99 that can be described equivalently in C, C++, Python, Rust and Zig, and yace generates, for each, code that is idiomatic for that language: for C, a C API with pretty-printers for every struct, union and enum. A field of bits, an integer whose parts are named by masks, is printed part by part, and read and written by part in every language. Headers outside the subset are parsed too, with every place they step outside it reported.
The project is hosted on GitHub, and its documentation is at safl.dk/yace.
Bindings are generated for C, C++, Python (ctypes, with a .pxd for
Cython), Rust, Zig and Go. Each target builds and runs a check of what it
generated against the layout the C compiler gives every record, and the C API
and Zig check every function's signature against the header too.
A header can also be written by a generator, from something other than C, and
taken as one written by hand: yace --generate file.py:Class, or a
generator installed by name. A generator proposed to xNVMe writes the NVMe
specification headers of xNVMe in this way, from the data model that senfd
makes of the specification documents.
Contributions are welcome; the documentation says how the code is laid out.
