Gamma is a self-hosting C preprocessor enabling simple, ergonomic templated data structures.
It’s primarily an experiment in designing a template engine for C in a minimal way (e.g., without having to parse C).
Gamma is a strict superset of C.
You merely set CC="gc gcc" to enable support for templates. Here’s a quickstart:
$ git clone https://lair.masot.net/git/gamma.git
$ cd gamma
$ make
$ cat examples/sorting.c
#include <string.h>
...
$ ./gc gcc examples/sorting.c -o sorting
$ ./sorting
1, 10, 50, 75
apple, hello, world
Gamma can be bootstrapped by normal C compilers, and is small enough to vendor into your own project, so it’s remains easy for others to use your code.
Gamma supports creating object files and static archives, and allows linking against normal C…
Gamma is a self-hosting C preprocessor enabling simple, ergonomic templated data structures.
It’s primarily an experiment in designing a template engine for C in a minimal way (e.g., without having to parse C).
Gamma is a strict superset of C.
You merely set CC="gc gcc" to enable support for templates. Here’s a quickstart:
$ git clone https://lair.masot.net/git/gamma.git
$ cd gamma
$ make
$ cat examples/sorting.c
#include <string.h>
...
$ ./gc gcc examples/sorting.c -o sorting
$ ./sorting
1, 10, 50, 75
apple, hello, world
Gamma can be bootstrapped by normal C compilers, and is small enough to vendor into your own project, so it’s remains easy for others to use your code.
Gamma supports creating object files and static archives, and allows linking against normal C object files.
Gamma was written by Matthew and Akshay.
Here’s a simple example showing how to define and use generic sort and print routines in Gamma:
And a generic vector data structure: