C*

C* (pronounced "C star") is a C-based hybrid low-level/high-level programming language focused on runtime performance and developer productivity (in this order of priority). It is unopinionated and flexible, supporting multiple paradigms and styles of programming, without friction or a steep learning curve.

Performance

C* compiles to efficient native code using LLVM. There's no garbage collection, hidden allocations, or runtime. C* takes a performance-first approach to common programming patterns, such as subtyping (tagged unions), map/filter/reduce (lazy iterators), and string/array handling (slices). Even fast compilation is a goal of C*.

Expressiveness

C* is a simple yet expressive language, featuring a strong type system with compile-time null-safety. It has all the features you'd except from a systems-level programming language, like pointers, RAII, templates, type inference, smart pointers, trait-like interfaces, and sum types. There's preprocessor, macros, or metaprogramming.

Productivity

C* allows effortless language interop: import C headers directly without the need for bindings. The clean and familiar C-like syntax avoids unnecessary boilerplate, allowing you to get instantly productive without a steep learning curve. Debug builds check for buffer or arithmetic overflows by default.

Example code

// A recursive directory listing program, demonstrating the usage of C APIs.

import "dirent.h";

void listdir(string name, int indent) {
    var dir = opendir(StringBuffer(name).cString());
    if (!dir) return;
    defer closedir(dir);

    while (var entry = readdir(dir)) {
        if (entry.d_name == "." || entry.d_name == "..")
            continue;

        var path = name + '/' + entry.d_name;
        println(" ".repeat(indent), path);

        if (entry.d_type == DT_DIR) {
            listdir(string(path), indent + 4);
        }
    }
}

void main() {
    listdir(".", 0);
}

Future plans