[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-82326":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":14,"forks30d":14,"starsTrendScore":12,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":14,"starSnapshotCount":14,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},82326,"tc-lang","alonsovm44\u002Ftc-lang","alonsovm44","A minimalistic portable assembly language",null,"C",37,3,22,0,1,7,13,45.61,false,"master",true,[],"2026-06-12 04:01:37","\u003Cp align=\"center\">\n  \u003Ch1 align=\"center\">Tight-C\u003C\u002Fh1>\n  \u003Cp align=\"center\">Simplest possible, usable systems language\u003C\u002Fp>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fversion-1.2.0-blue?style=flat-square\" alt=\"Version\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flanguage-C11-orange?style=flat-square\" alt=\"Language\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-green?style=flat-square\" alt=\"License\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fplatform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey?style=flat-square\" alt=\"Platform\">\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frepo-size\u002Falonsovm44\u002Ftc-lang?style=flat-square\" alt=\"Repo Size\">\n\u003C\u002Fp>\n\n---\n\nTight-C is a minimalistic systems programming language.\n\n## What's New in v1.2.0\n\n- **Varargs support** — Functions can now declare and use variadic arguments with `...`\n- **Expanded I\u002FO stdlib** — Added file I\u002FO functions (fopen, fclose, fgetc, fputs, fprintf, fscanf, feof, etc.)\n- **Else if statements** — Added `_if` for chained conditionals with `_` as else wildcard\n- **Match statements** — Pattern matching with wildcard support\n\n## Project Goals\n> Make the first mainstream systems langauge from Mexico.\n> Explore the bare minimum of what a systems language must have to be usable, modern and ergonomic\n\n## Features\n\n- **12 keywords** — `if`, `loop`, `break`, `defer`, `ret`, `strun`, `fn`, `use`, `pub`, `pin`, `match`, `hot`\n- **No hidden magic** — no GC, no type inference, no shadowing, no aliasing\n- **Raw pointers** (`->`) and **fat pointers** (`=>`) with built-in slicing\n- **Manual memory** — `alloc()` \u002F `free()` with `defer` for cleanup\n- **Packed structs** — no padding, predictable layout\n- **C FFI** — `extern \"C\"` for direct interop\n- **Rust-style errors** — colored diagnostics with source lines and carets\n- **One-step compile** — `tightc source.tc -c app` transpiles and compiles in one command\n- **Inline imports** — `@use \"lib.tc\"` inlines another `.tc` file at compile time\n- **CLI args** — `i32 fn main: =>->i8 args { ... }` for command-line tools\n\n\n## Philosophy\n\n**Why it was made**: I wanted a simple systems language with less keywords than Go, without GC and without heavy runtime overhead.\n**Backend**: For now it is C11 \n**Concurrency and Safety?**: I've been toying around \n\n### Inspiration\n- Pony\n- Go\n- C\n- Rust\n\n### Core principle:\n> Everything that can be built with libraries has to be built with libraries. The core language is small.\n\n## Quick Start\n\n```bash\n# Build the compiler\nmake\n\n# Compile stdlib headers (only needed once)\n.\u002Ftightc stdlib\u002Fio.tc -o stdlib\u002Fio.h\n\n# One-step: transpile + compile to binary\n.\u002Ftightc samples\u002Ffizzbuzz.tc -c fizzbuzz\n.\u002Ffizzbuzz\n\n# Or two-step: transpile to C, then compile yourself\n.\u002Ftightc samples\u002Ffizzbuzz.tc -o fizzbuzz.c\ngcc fizzbuzz.c -std=c11 -o fizzbuzz\n```\n\n## How It Works\n\nTight-C is a **source-to-source compiler** (transpiler) written in ~1800 lines of C. It reads `.tc` files and outputs portable C11.\n\n```\nsource.tc → [Lexer] → [Parser] → [AST] → [Emitter] → output.c → gcc\u002Fclang → binary\n```\n\n### Pipeline\n\n1. **Lexer** (`lexer.c`) — Tokenizes source into identifiers, literals, keywords, and symbols. Tracks line\u002Fcol for error reporting.\n2. **Parser** (`parser.c`) — Builds an AST from tokens. Handles operator precedence, scope-level `pin` enforcement, and `@use` file inlining (recursive parse + splice).\n3. **Emitter** (`emitter.c`) — Walks the AST and outputs C11. Most constructs are 1:1 with targeted transforms:\n\n| Tight-C | Emitted C |\n|---------|-----------|\n| `=>i32 s` | `tc_fat_i32 s` (struct with `.ptr` + `.len`) |\n| `defer { free(p) }` | Scope-exit statements emitted in reverse order before `}` and `return` |\n| `pin x` | Nothing emitted — enforced at parse time (compile error on reassignment) |\n| `@use \"lib.tc\"` | Declarations inlined directly into AST (no `#include`) |\n| `alloc(T, n)` | `TC_ALLOC(T, n)` → `calloc(n, sizeof(T))` |\n| `=>->i8 args` in main | `main(int argc, char **argv)` + local fat pointer wrapping them |\n\n### What it is *not*\n\nThere is no optimizer, no IR, no type inference pass, and no code generation beyond string concatenation of C. The output is always **readable, debuggable C** that you can inspect with `tightc source.tc -o source.c`.\n\n## Design Goals\n\n| Goal | How |\n|------|-----|\n| **Predictability** | Every line maps to obvious C. No hidden allocations, no implicit copies, no vtables. |\n| **Simplicity** | 10 keywords. The entire compiler is a single-pass parser + tree-walk emitter. |\n| **Portability** | Output is C11 with no platform-specific extensions. Compiles with gcc, clang, or any conforming C compiler. |\n| **Safety without runtime cost** | Fat pointers carry length at zero overhead (struct field). `pin` catches mutation bugs at compile time. `defer` prevents resource leaks. |\n| **Interop** | `extern \"C\"` blocks let you call any C library directly. `use` includes `.h` files. The generated code is linkable from C. |\n\n### What Tight-C is good for\n\n- **CLI tools** — parse args, process files, call system APIs\n- **Embedded \u002F bare-metal** — no runtime, no allocator required, predictable memory layout (packed structs)\n- **Game engine internals** — manual memory, no GC pauses, direct pointer control\n- **Learning compilers** — small enough to read in an afternoon, real enough to produce working binaries\n- **C codebases that want better ergonomics** — fat pointers, defer, slicing, without leaving the C ecosystem\n\n### What is intentionally skipped (for now)\n\n- **Generics \u002F templates** — explicitness over abstraction\n- **OOP \u002F inheritance** — composition via structs\n- **Garbage collection** — manual memory is the point\n- **Type inference** — all types are visible at declaration\n- **Exceptions** — return error codes, check them\n- **Runtime reflection** — if you need it, you're in the wrong language\n\n## Hello World\n\n```\nuse \"stdlib\u002Fio.tc\"\n\nfn void main: {\n    print(\"hello, world\")\n}\n```\n\n## Syntax Overview\n\n### Variables\n```\ni32 x = 10\nf64 pi = 3.14\nu8 byte\n```\nUninitialized variables default to `0`.\n\n### Functions\n```\nfn i32 add: i32 a, i32 b {\n    ret a + b\n}\n```\n\n### Varargs\nFunctions can declare variadic arguments with `...`:\n```\nextern \"C\" {\n    i32 fn printf: ->i8 fmt, ... {}\n}\n```\nNote: `...` in function calls is implicit - you don't need to write it when calling varargs functions.\n\n### Strunions (Layout polymorphism)\nBoth a struct and a union, this way we dont need two keywords for structs and unions\nNow we have a spectrum.\n\n[struct]—[strun]—[union]\n\nUse `&` to create a union element inside the strun. \n\nFor a normal struct:\n```\nstrun Point{\n  i32 x,\n  i32 y\n}\n```\nFor a Union:\n```\nstrun Data{\n  &i32 data\n  &str ip\n}\n```\nFor a strun:\n```\nstrun hybrid{\n  i32 x\n  i32 y\n  &i32 z\n  &f32 w\n}\n```\n`z` and `w` share the same memory location.\n- Anonymous padding\nYou can padd memory inside struns with anonymous types\nExample:\n```\nstrun hybrid{\n  &i32 x\n  &i32 y\n  i32 \u002F\u002F anonymous padding\n  &i32 z\n  &f32 w\n}\n```\nThis groups `x` and `y` together, and `z` and `w` together.\n\n### Pointers\n```\ni32 x = 42\n->i32 ptr = @x          \u002F\u002F raw pointer (address-of)\n->ptr = 99              \u002F\u002F dereference\n\ni32[4] arr = {1,2,3,4}\n=>i32 slice = @arr       \u002F\u002F fat pointer from array\nprinti(slice.len)        \u002F\u002F built-in length\nprinti(slice.ptr[0])     \u002F\u002F access elements\n\n=>i32 sub = arr[1:3]     \u002F\u002F slicing\n```\n\n### Pointer Combos\n```\n->->i32 pp = @p          \u002F\u002F pointer to pointer\n=>->i32 fps = @ptrs      \u002F\u002F fat pointer of raw pointers\n->=>i32 pslice = @slice  \u002F\u002F raw pointer to fat pointer\n=>=> sslice = @slice     \u002F\u002F fat pointer to fat pointer\n```\n\n### Control Flow\n```\nif (x > 0) { ... }\n\nloop { ... break }          \u002F\u002F infinite loop unless break\n\nloop if (i \u003C 10) { ... }    \u002F\u002F conditional loop\n```\n\n### Memory\n```\n->i32 arr = alloc(i32, 100)\ndefer { free(arr) }\n```\n\n### Imports\n```\nuse \"stdlib\u002Fio.tc\"       \u002F\u002F link to pre-compiled .h\n@use \"utils.tc\"          \u002F\u002F inline .tc at compile time\n```\n\n### CLI Arguments\n```\ni32 fn main: =>->i8 args {\n    printi(args.len)         \u002F\u002F argc\n    print(args.ptr[1])       \u002F\u002F first user argument\n    ret 0\n}\n```\n\n### C FFI\n```\nextern \"C\" {\n    i32 fn printf: ->i8 fmt, ... {}\n}\n```\n\n### Error Reporting\n```\nerror[E000]: cannot assign to pinned variable 'x'\n --> samples\u002Fpin.tc:8:5\n   |\n 8 |     x = 11 \u002F\u002F this should be illegal since x is pinned in this scope\n   |     ^ cannot assign to pinned variable 'x'\n\nE000\nType \"tightc --error E000\" for help\n\nPS C:\\Users\\me\\.projects\\langs\\tc> .\u002Ftightc --error E000\nE000: Assignment to pinned variable\n\nA variable marked with `pin` is immutable in the current scope.\nYou cannot reassign it with `=`, `+=`, `-=`, or any other assignment.\n\nBad:\n    i32 x = 10\n    pin x\n    x = 11       \u002F\u002F error: cannot assign to pinned variable\n\nFix: remove the `pin` or avoid reassigning the variable.\n```\n### Else if stmts\nNote, _if syntax is destined to change for v1.2.1 for something more ergonomic\n\n```\nif(condition){\n  \u002F\u002F code\n}\n_if(condition){ \n  \u002F\u002F code\n}\n_ { \u002F\u002F \"_\" is the tC wildcard for otherwise\u002Felse\n  \u002F\u002F code\n}\n\n```\n### Match stmts\n```\nmatch (n) {\n        1 = {\n            print(\"one\")\n        }\n        2 = {\n            print(\"two\")\n        }\n        3 = {\n            print(\"three\")\n        }\n        _ = {\n            print(\"other\")\n        }\n    }\n\n```\n\n## Types\n\n| Tight-C | C Equivalent |\n|---------|-------------|\n| `i8`    | `char`      |\n| `i16`   | `int16_t`   |\n| `i32`   | `int32_t`   |\n| `i64`   | `int64_t`   |\n| `u8`    | `uint8_t`   |\n| `u16`   | `uint16_t`  |\n| `u32`   | `uint32_t`  |\n| `u64`   | `uint64_t`  |\n| `f32`   | `float`     |\n| `f64`   | `double`    |\n| `void`  | `void`      |\n\n## Compiler Usage\n\n```bash\ntightc \u003Cinput.tc> [-o output.c] [-c binary]\n```\n\n| Flag | Description |\n|------|-------------|\n| `-o file.c` | Emit transpiled C to file (`.h` gets `#pragma once`) |\n| `-c binary` | Transpile + compile to binary (auto-detects gcc\u002Fclang) |\n| (none) | Print transpiled C to stdout |\n\nCombine both: `tightc app.tc -o app.c -c app` keeps the `.c` and builds the binary.\n\n## Hot Reloading\n\nTight-C supports hot reloading of functions marked with the `hot` keyword. This allows you to modify code and recompile shared libraries without restarting the main executable.\n\n### Basic Usage\n\n```bash\n# Initial compile with hot reload enabled\ntightc hot.tc -H hotlib -c hotfn\n\n# Run the application\n.\u002Fhotfn\n\n# While running, modify hot.tc and rebuild only the hot library\ntightc hot.tc -H hotlib --hot-rebuild\n```\n\nThe running application will automatically detect the change and reload the library on the next hot function call.\n\n### How It Works\n\nHot reload uses versioned shared libraries to avoid file locking issues on Windows:\n\n- Functions marked with `hot` are compiled into a separate shared library\n- Each rebuild creates a new version (e.g., `hotlib_1.dll`, `hotlib_2.dll`)\n- A version file tracks the current version number\n- The host executable monitors the version file and dynamically loads new versions\n\n### Example\n\n```tightc\nuse \"stdlib\u002Fio.tc\"\n\nextern \"C\" {\n    i32 fn Sleep: u32 ms {}\n}\n\nhot fn i32 add: i32 x, i32 y {\n    ret x + y + 10\n}\n\nfn void main: {\n    loop {\n        i32 result = add(3, 4)\n        printi(result)\n        Sleep(2000)\n    }\n}\n```\n\nRunning this prints `17` every 2 seconds. If you change `ret x + y + 10` to `ret x + y + 20` and rebuild with `--hot-rebuild`, the output will change to `24` without restarting the application.\n\n### Additional Flags\n\n| Flag | Description |\n|------|-------------|\n| `-H \u003Clibname>` | Enable hot reload mode, specify the library name |\n| `--hot-rebuild` | Rebuild only the hot library (for running applications) |\n| `-t, --temp` | Keep temporary .c files for debugging |\n\n### Proof of Concept\n\nSee the `HOTSWAPPING\u002F` folder for a complete working example with documentation, including the demo output showing hot reload in action.\n\nThis feature demonstrates Tight-C's capability for advanced systems programming patterns, using the industry-standard approach to hot reload on Windows (versioned libraries).\n\n## Project Structure\n\n```\ntc-lang\u002F\n  compiler\u002F\n    include\u002F     # Header files\n    src\u002F         # Compiler source (C)\n  stdlib\u002F        # Standard library (.tc)\n  samples\u002F       # Example programs\n  docs\u002F          # Language specification\n  Makefile       # Build system\n```\n\n## Stdlib\n\n**`stdlib\u002Fio.tc`** — I\u002FO\n\n| Function     | Description                |\n|--------------|----------------------------|\n| `print(s)`   | Print string + newline     |\n| `printn(s)`  | Print string, no newline   |\n| `printi(n)`  | Print i64 + newline        |\n| `printin(n)` | Print i64, no newline      |\n| `readi()`    | Read i64 from stdin        |\n| `readc()`    | Read single char from stdin|\n| `unreadc(c, stream)` | Push char back to file stream |\n| `write_file(s, stream)` | Write string to file |\n| `eof(stream)` | Check if at end of file |\n\n**File I\u002FO (via extern \"C\")**\n\n| Function     | Description                |\n|--------------|----------------------------|\n| `fopen(file, mode)` | Open file |\n| `fclose(f)` | Close file |\n| `fgetc(stream)` | Read char from file |\n| `ungetc(c, stream)` | Push char back to file |\n| `fputs(s, stream)` | Write string to file |\n| `fprintf(stream, fmt, ...)` | Formatted print to file |\n| `fscanf(stream, fmt, ...)` | Formatted read from file |\n| `feof(stream)` | Check end of file |\n\n**`stdlib\u002Fstr.tc`** — Strings\n\n| Function              | Description                          |\n|-----------------------|--------------------------------------|\n| `slen(s)`             | String length                        |\n| `seq(a, b)`           | String equality (returns 1 if equal) |\n| `scpy(dest, src)`     | Copy string                          |\n| `scat(dest, src)`     | Concatenate strings                  |\n| `sneq(a, b, n)`       | Compare first n bytes                |\n| `sfind(s, c)`         | Find first char occurrence           |\n| `sfindlast(s, c)`     | Find last char occurrence            |\n| `shas(haystack, needle)` | Find substring                    |\n\n**`stdlib\u002Fmath.tc`** — Math\n\n| Function             | Description                       |\n|----------------------|-----------------------------------|\n| `iabs(x)`            | Absolute value (integer)          |\n| `min(a, b)`          | Minimum of two integers           |\n| `max(a, b)`          | Maximum of two integers           |\n| `clamp(x, lo, hi)`   | Clamp value to range              |\n| `sqrt64(x)`          | Square root (f64)                 |\n| `pow64(base, exp)`   | Power (f64)                       |\n| `fabs64(x)`          | Absolute value (f64)              |\n| `sin`, `cos`, `tan`  | Trig functions (extern C)         |\n| `log`, `log2`, `log10` | Logarithms (extern C)           |\n\n**`stdlib\u002Fmem.tc`** — Memory\n\n| Function              | Description                       |\n|-----------------------|-----------------------------------|\n| `zero(ptr, n)`        | Zero out n bytes                  |\n| `copy(dest, src, n)`  | Copy n bytes (overlap safe)       |\n| `memeq(a, b, n)`      | Compare n bytes (1 if equal)      |\n| `fill(ptr, val, n)`   | Fill n bytes with value           |\n\n**`stdlib\u002Fconv.tc`** — Conversions\n\n| Function              | Description                       |\n|-----------------------|-----------------------------------|\n| `stoi(s)`             | String to i64                     |\n| `stoib(s, base)`      | String to i64 with base           |\n| `stof(s)`             | String to f64                     |\n| `itos(n, buf, size)`  | i64 to string (into buffer)       |\n| `ftos(n, buf, size)`  | f64 to string (into buffer)       |\n\n## Building the Compiler\n\nRequires `gcc` (or `clang`) and `make`.\n\n```bash\nmake          # Build tightc\nmake clean    # Remove build artifacts\n```\n\n---\n\n\u003Cp align=\"center\">\n  \u003Csub>Built by \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Falonsovm44\">@alonsovm44\u003C\u002Fa>\u003C\u002Fsub>\n\u003C\u002Fp>\n","Tight-C 是一种极简的系统编程语言，旨在提供一个简洁、现代且易用的开发工具。它拥有12个关键字，并支持手动内存管理、原始指针和胖指针、无GC以及直接与C语言互操作等功能。Tight-C通过其内置的一系列特性如varargs支持、扩展的I\u002FO标准库、匹配语句等，为开发者提供了构建高效系统级应用的基础。此项目特别适合需要低级控制但又希望保持代码简洁性的场景使用，比如操作系统组件、嵌入式系统或是任何追求极致性能的应用程序开发。此外，Tight-C作为源到源的编译器，能够将`.tc`文件转换成可移植的C11代码，简化了跨平台部署的过程。",2,"2026-06-11 04:08:23","CREATED_QUERY"]