aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-07-10 20:22:13 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-07-10 20:22:13 +0300
commit296d6abd85a16c9c9d112fe6282f8ac81ce088d3 (patch)
treea9875733ed846f5ff9a8aca794fdfe2f6df24c8a
parent645a8026b6f6a89cda5a24d96cf3de39c3ab32e1 (diff)
downloadngc-296d6abd85a16c9c9d112fe6282f8ac81ce088d3.tar.gz
ngc-296d6abd85a16c9c9d112fe6282f8ac81ce088d3.zip
add READMEHEADmaster
-rw-r--r--README.md45
1 files changed, 45 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..eeecaad
--- /dev/null
+++ b/README.md
@@ -0,0 +1,45 @@
+# `ngc`
+
+This a rough intial implementation of a subset of ideas presented in my blogpost
+[Coming up with a new type system on top of C](https://metanimi.dy.fi/blog/cng/).
+
+# TL;DR
+
+This is largely just an attempt to formalize existing practice for type-generic
+data structures in C. Essentially, to avoid having to mangle names, generic data
+structures are typically generated with some constructor macros that take in a
+user-provided name. See `example_vec/old/vec.h` for a fairly simple example, and
+the equivalent `example_vec/new/vec.h` for what this program deals with instead.
+
+I also have some ideas for ways to extend this idea, including incorporating some kind of
+trait system. See the blog post more some more details.
+
+# Setup
+
+```sh
+make
+export PATH=$PATH:$PWD
+```
+
+No install for now, this is not intended for any serious use.
+
+# Usage
+
+```sh
+./ngc example_vec/new/main.c -o vec
+```
+
+`ngc` is a wrapper around a `gcc`-like compiler, so all flags that `gcc` accepts
+should work here as well. `ngc1` is the 'actual' program that handles type
+expansion etc. and jumps in between the preprocessing and actual compilation of
+your C.
+
+# Current status
+
+Just enough working that `example_vec/new/vec.h` generates useful code. I
+recently got a bit interested in this idea again so I might implement some more
+features in the near future, probably starting with supertemplates.
+
+Line numbering gets a bit messed up sometimes, I should actually parse the
+linemarkers that `gcc` outputs. TODO (although preferably this functionality
+would be integrated into a compiler directly).