The Gamma Language
lair.masot.net·21h·
Discuss: Hacker News
🦀Rust Macros
Preview
Report Post

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…

Similar Posts

Loading similar posts...