|
CCCC
C bytecode compiler + VM interpreter
|
CCCC (C**omprehensive **C **C**ompensation **C**ompiler) compiles C to bytecode and runs it in a built-in VM. It is a drop-in frontend for cc, clang and gcc: a compile-time pass between the preprocessor and the parser runs [[cccc::comptime]] functions and expands their results, and -c=native hands the result to a host compiler.
This site documents the public headers. The user guides live in docs/.
| Header | Use it to | Guide |
|---|---|---|
| cccc/building.h | Write --build scripts: targets, profiles, cross-compilation | build |
| cccc/reflection.h | Write comptime macros: inspect, build and quote AST nodes | macros |
| cccc/testing.h | Write [[cccc::test]] tests with the Assert* macros | testing |
| cccc/kernel.h | Launch [[cccc::kernel]] functions over a grid of work-items | kernels |
| omp.h | Call the OpenMP runtime API under -fopenmp | openmp |
| cccc/opencl.h | Read OpenCL C 1.2 kernels (.cl, -x cl) onto the kernel model | opencl |
cccc/derive.h | Generate serializers, accessors, equality, JSON and more with attributes such as @serialize and @to_json | derive |
cccc/json.h | Runtime behind @to_json / @from_json; include it next to derive.h | derive |
testing.h, building.h and opencl.h are injected automatically in their modes. reflection.h is available to comptime code without an include. derive.h and json.h are ordinary includes; they have no generated reference pages, so use the guide.
A build.c script declares targets with the Builder API of building.h: each target is a function returning a BuildTarget *, run with cccc --build build.c --build-target=<name>. CCCC's own build.c is a working example, and its docs target builds this site.