Tech News
← Back to articles

The Gamma Language

read original related products more articles

The Gamma Language

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.

Update 12/25: You might be interested in MaC, a similar experiment in C templates that allows for significantly more reflection on types (e.g., you could write an automated serializer generator).

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 ... $ ./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.

... continue reading