yace

Welcome to yace

PyPI Build Status https://coveralls.io/repos/github/safl/yace/badge.svg?branch=main pre-commit

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.

The project is hosted on GitHub, and its documentation is at safl.dk/yace.

Bindings are generated for C, C++, Python (ctypes), Cython (a compiled module, and a .pxd of the C API), 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.