{"slug": "show-hn-tight-c-a-systems-language-with-10-keywords", "title": "Show HN: Tight C, a systems language with 10 keywords", "summary": "Tight C is a minimal systems programming language that compiles to C11 and features only 10 keywords, with no garbage collector, type inference, or object-oriented programming. It offers manual memory management through `alloc()` and `free()`, raw and fat pointers with built-in slicing, packed structs, and direct C FFI via `extern \"C\"`. The language prioritizes simplicity and predictability, aiming to provide C-level power without its historical complexity.", "body_md": "Simplest possible, usable systems language\n\nTight-C is a minimal systems programming language that compiles to C. It has **10 keywords**, no garbage collector, no inference, no OOP — just explicit, predictable code with C-level power.** 10 keywords**—`if`\n\n,`loop`\n\n,`break`\n\n,`defer`\n\n,`ret`\n\n,`struct`\n\n,`fn`\n\n,`use`\n\n,`pub`\n\n,`pin`**No hidden magic**— no GC, no type inference, no shadowing, no aliasing** Raw pointers**(`->`\n\n) and**fat pointers**(`=>`\n\n) with built-in slicing**Manual memory**—`alloc()`\n\n/`free()`\n\nwith`defer`\n\nfor cleanup**Packed structs**— no padding, predictable layout** C FFI**—`extern \"C\"`\n\nfor direct interop**Compiles to C11**— readable output, use any C toolchain\n\n```\n# Build the compiler\nmake\n\n# Compile stdlib\n./tcc stdlib/io.tc -o stdlib/io.h\n\n# Compile a program\n./tcc samples/fizzbuzz.tc -o fizzbuzz.c\n\n# Build and run\ngcc fizzbuzz.c -std=c11 -o fizzbuzz\n./fizzbuzz\nuse \"stdlib/io.tc\"\n\nvoid fn main: {\n    print(\"hello, world\")\n}\ni32 x = 10\nf64 pi = 3.14\nu8 byte\n```\n\nUninitialized variables default to `0`\n\n.\n\n```\ni32 fn add: i32 a, i32 b {\n    ret a + b\n}\nstruct Point {\n    i32 x,\n    i32 y\n}\n\nPoint p\np.x = 10\nphp\ni32 x = 42\n->i32 ptr = @x       // address-of\n->ptr = 99           // dereference\n\n=>i32 slice = arr[1:4]  // fat pointer (slice)\ni32 len = slice.len      // built-in length\nif (x > 0) { ... }\n\nloop { ... break }\n\nloop if (i < 10) { ... }\nphp\n->i32 arr = alloc(i32, 100)\ndefer { free(arr) }\nphp\nextern \"C\" {\n    i32 fn printf: ->i8 fmt, ... {}\n}\n```\n\n| Tight-C | C Equivalent |\n|---|---|\n`i8` |\n`char` |\n`i16` |\n`int16_t` |\n`i32` |\n`int32_t` |\n`i64` |\n`int64_t` |\n`u8` |\n`uint8_t` |\n`u16` |\n`uint16_t` |\n`u32` |\n`uint32_t` |\n`u64` |\n`uint64_t` |\n`f32` |\n`float` |\n`f64` |\n`double` |\n`void` |\n`void` |\n\n```\ntc-lang/\n  compiler/\n    include/     # Header files\n    src/         # Compiler source (C)\n  stdlib/        # Standard library (.tc)\n  samples/       # Example programs\n  docs/          # Language specification\n  Makefile       # Build system\n```**stdlib/io.tc** — I/O\n\n| Function | Description |\n|---|---|\n`print(s)` |\nPrint string + newline |\n`printn(s)` |\nPrint string, no newline |\n`printi(n)` |\nPrint i64 + newline |\n`printin(n)` |\nPrint i64, no newline |\n`readi()` |\nRead i64 from stdin |\n`readc()` |\nRead single char from stdin |**stdlib/str.tc** — Strings\n\n| Function | Description |\n|---|---|\n`slen(s)` |\nString length |\n`seq(a, b)` |\nString equality (returns 1 if equal) |\n`scpy(dest, src)` |\nCopy string |\n`scat(dest, src)` |\nConcatenate strings |\n`sneq(a, b, n)` |\nCompare first n bytes |\n`sfind(s, c)` |\nFind first char occurrence |\n`sfindlast(s, c)` |\nFind last char occurrence |\n`shas(haystack, needle)` |\nFind substring |**stdlib/math.tc** — Math\n\n| Function | Description |\n|---|---|\n`iabs(x)` |\nAbsolute value (integer) |\n`min(a, b)` |\nMinimum of two integers |\n`max(a, b)` |\nMaximum of two integers |\n`clamp(x, lo, hi)` |\nClamp value to range |\n`sqrt64(x)` |\nSquare root (f64) |\n`pow64(base, exp)` |\nPower (f64) |\n`fabs64(x)` |\nAbsolute value (f64) |\n`sin` , `cos` , `tan` |\nTrig functions (extern C) |\n`log` , `log2` , `log10` |\nLogarithms (extern C) |**stdlib/mem.tc** — Memory\n\n| Function | Description |\n|---|---|\n`zero(ptr, n)` |\nZero out n bytes |\n`copy(dest, src, n)` |\nCopy n bytes (overlap safe) |\n`memeq(a, b, n)` |\nCompare n bytes (1 if equal) |\n`fill(ptr, val, n)` |\nFill n bytes with value |**stdlib/conv.tc** — Conversions\n\n| Function | Description |\n|---|---|\n`stoi(s)` |\nString to i64 |\n`stoib(s, base)` |\nString to i64 with base |\n`stof(s)` |\nString to f64 |\n`itos(n, buf, size)` |\ni64 to string (into buffer) |\n`ftos(n, buf, size)` |\nf64 to string (into buffer) |\n\nRequires `gcc`\n\nand `make`\n\n.\n\n```\nmake          # Build tcc\nmake clean    # Remove build artifacts\n```\n\nEverything that can be built in the stdlib has to.\n\nTight-C bets that C's power doesn't require C's complexity. Strip away the historical baggage and you get a language a single person can implement, understand fully, and still write real systems code in.\n\nBuilt by @alonsovm44", "url": "https://wpnews.pro/news/show-hn-tight-c-a-systems-language-with-10-keywords", "canonical_source": "https://github.com/alonsovm44/tc-lang/", "published_at": "2026-05-22 03:33:40+00:00", "updated_at": "2026-05-22 04:34:35.811557+00:00", "lang": "en", "topics": ["developer-tools", "open-source"], "entities": ["Tight C", "C", "C11", "gcc"], "alternates": {"html": "https://wpnews.pro/news/show-hn-tight-c-a-systems-language-with-10-keywords", "markdown": "https://wpnews.pro/news/show-hn-tight-c-a-systems-language-with-10-keywords.md", "text": "https://wpnews.pro/news/show-hn-tight-c-a-systems-language-with-10-keywords.txt", "jsonld": "https://wpnews.pro/news/show-hn-tight-c-a-systems-language-with-10-keywords.jsonld"}}