Show HN: Nibble

· coding · Source ↗

TLDR

  • Nibble is a C-like systems language written in 3000 lines of C that generates LLVM IR with no malloc and no external dependencies.

Key Takeaways

  • Single-pass top-down compilation with stack-only allocation keeps the implementation in one readable main.c file.
  • Supports defer, recursion, structs, GLSL-like struct operators, function pointers, basic C interop via generic pointers, and type checking.
  • Four SDL2 graphical demos included: two multithreaded software renderers of ShaderToy-style demos, a red-black tree demo, and a game programming setup.
  • Known issue: allocas inside loops without hoisting can cause stack overflows at lower and higher Clang optimization levels.
  • Author explored stacksave/stackrestore as a fix but considers the compiler complete after satisfying LLVM IR curiosity.

Hacker News Comment Review

  • No substantive HN discussion yet.

Original | Discuss on HN