Welcome to cgen’s documentation!

cgen offers a simple abstract syntax tree for C and related languages (C++/CUDA/OpenCL) to allow structured code generation from Python.

Here’s an example, to give you an impression:

This prints the following:

char const *greet()
{
  return "hello world";
}

cgen deliberately does not worry about expression trees. Its sister package pymbolic can help you build those.

Indices and tables