A transpiler-based extension of C. Write modern, expressive code — default parameters, function overloading, defer, modules, a math library — and compile it with any C compiler. No runtime. No bloat. No OOP.
G adds exactly what developers reach for — nothing more, nothing less.
Functions can declare default values. heal(amount=10) — call with or without the argument.
Same name, different types or argument counts. No macros, no runtime cost — rewritten at transpile time.
Register cleanup code at the point of resource acquisition. LIFO execution before every return.
#module Entity namespaces all symbols automatically. #import Entity as e with dot-syntax access.
Declare field defaults inline. Auto-generated _Entity_init() — no manual boilerplate.
Embed a struct's fields directly into a parent with using. Access nested fields without dot-chaining — flat, direct, zero overhead.
Primitive-returning functions wrap in Result_T. Check .error, use .value. No exceptions.
GMath (Vec2/3/4, Mat4, Quaternion), GString (safe strings), GArray (dynamic arrays). Ready for SDL and OpenGL.
gompile transpiles. guild build handles the full pipeline. VSCodium extension with LSP and debugger.
Variables declared but not initialized default to 0, '\0', or NULL — never garbage. Opt out explicitly with undefined.
G-Lang requires Python 3.10+, GCC, and optionally GDB for debugging. Clone the repo and run setup:
setup.sh installs gompile and guild commands to ~/.local/bin/ and optionally installs the VSCodium extension.
| Context | Name |
|---|---|
| Language | G / G-Lang |
| File extension | .g |
| Transpiler script | gompile.py |
| Transpiler command | gompile |
| Build system | guild / guild.py |
| Generated C output | gompiled/Name.c |
| Generated header | gompiled/Name.h |
| Source maps | gompiled/Name.map.json |
Choose the package that fits your needs. Both require Python 3.10+, GCC, and GDB.
Ready to build projects — clean and minimal
Full source including tests and debug demo
Or install directly from the command line:
The transpiler and build system are pure Python. No pip installs needed.
Any C compiler that handles C11. GCC is the default; set cc = "clang" in guild.toml to switch.
For full source-level debugging. Set a breakpoint in your .g file, step through, inspect variables.
C is the language games are built in. From id Software's Quake... to modern indie engines, C's performance, predictability, and direct hardware access make it the pragmatic choice. But C has papercuts — small, daily frustrations that accumulate over a project.
G-Lang fixes the papercuts. It's a transpiler that converts G source files to standard C before compilation. The output is readable, debuggable C that you can inspect, modify, and compile with any C toolchain.
G adds exactly what developers — game developers especially — reach for constantly: default parameters so
you stop writing boilerplate, function overloading so vec_add works for Vec2 and Vec3,
defer for deterministic cleanup, a module system that namespace everything automatically,
and a math library that pairs directly with OpenGL and Vulkan.
using.
gompile.py and guild.py require only Python's standard library. Clone and go.
G-Lang is at v0.3.0. The language is functional and usable end-to-end — transpiler, build system, standard library, and full VSCodium integration with syntax highlighting, autocomplete, and a source-level debugger.
It has not yet been battle-tested in a shipped game. 1.0 means a real game ships with it. That's the milestone.
Built by Garrett Gaston. Source on Codeberg. MIT License.