Skip to main content

RGC — A Python-Flavored Compiled Language

Python developers feel at home: def / if / elif / else / for / while / and / or / not / None, brace blocks, # comments.
Compiled with LLVM, ownership-based memory safety, designed for systems programming.

RGC is a compiled, statically typed, memory-safe systems programming language whose syntax aligns with the Python ecosystem, letting Python developers write high-performance native programs with a familiar style:

  • Python-flavored syntax: keywords and habits aligned with Python; brace blocks {} instead of indentation
  • Compiled: LLVM backend emits native machine code, with performance close to C / Rust
  • Statically typed: compile-time type checking with inference; errors surface early
  • Memory safe: ownership + borrow checking, no GC, zero runtime overhead
  • Modern expressiveness: algebraic data types, pattern matching, generics, module system
  • Self-hosted: RGC is ultimately implemented in RGC itself

Example​

def fib(n: int) -> int {
if n <= 1 {
return n
}
return fib(n - 1) + fib(n - 2)
}

def main() {
print("fib(10) =", fib(10))
}

Installation​

Requirements​

  • LLVM 23 (self-contained distribution)
  • CMake ≥ 3.31
  • GCC 13.3+ or Clang

Build​

cd compiler
cmake -B build -DCMAKE_BUILD_TYPE=Release \
-DLLVM_DIR=/path/to/LLVM-23.1.4-Linux-X64/lib/cmake/llvm
cmake --build build -j4

Compile and run​

# Compile and run an example
./build/rgc examples/hello.rg -o hello
./hello

# Dump the AST
./build/rgc examples/hello.rg --ast-dump

Continue reading​