c3lang /c3c

Compiler for the C3 language

★ 5,964⑂ 412👁 42⑃ 1,575● 1,889▤ 42
C3MITCreated 2019-07-31c3-lang.org
Download: Version 0.8.6Version-0.8.6 ↓0.8.62026-11-11
+3
Daily
5,964
stars
412
forks
42
watchers
1,575
prs
1,889
issues
42
releases

README

C3 Language


C3 is a general-purpose programming language for building fast native software:
applications, games, tools, servers, libraries, and systems.

It's an evolution, not a revolution: familiar C syntax and semantics, modernized for everyday development.

Precompiled binaries for the following operating systems are available:

- Windows x64 download, install instructions.
- Linux x64 download, install instructions.
- MacOS Arm64 download, install instructions.
- OpenBSD x64 download, install instructions.

To build the compiler from source instead, see the instructions for building C3 from source.

[Read the C3 Manual] [Try it out in the browser]

---



 [!NOTE]
 Thanks to full ABI compatibility with C, it's possible to mix C and C3 in the same project with no effort.
 As a demonstration, vkQuake was compiled with a small portion of the code converted to C3 and compiled with the c3c compiler.
 (The aging fork can be found at https://github.com/c3lang/vkQuake)


A non-curated list of user written projects and other resources can be found here.

---

 Design Principles
- Procedural "get things done"-type of language.
- Try to stay close to C - only change what's really necessary.
- C ABI compatibility and excellent C integration.
- Learning C3 should be easy for a C programmer.
- Data is inert.
- Avoid "big ideas" & the "more is better" fallacy.
- Evolve C into an ergonomic language for modern application development.

C3 owes its inspiration to the C2 language: to iterate on top of C without inventing an entirely new language.

 Example code

The following code shows generics (more examples can be found at https://c3-lang.org/language-overview/examples/).

c3
module stack ;
// Above: the parameterized type is applied to the entire module.

struct Stack
{
    sz capacity;
    sz size;
    Type elems;
}

// The type methods offers dot syntax calls,
// so this function can either be called
// Stack.push(&my_stack, ...) or
// my_stack.push(...)
fn void Stack.push(Stack this, Type element)
{
    if (this.capacity == this.size)
    {
        this.capacity = 2;
        if (this.capacity  0);
    return this.elems[--this.size];
}

fn bool Stack.empty(Stack this)
{
    return !this.size;
}


Testing it out:

c3
import stack;

// Define our new types, the first will implicitly create
// a complete copy of the entire Stack module with "Type" set to "int"
alias IntStack = Stack {int};
// The second creates another copy with "Type" set to "double"
alias DoubleStack = Stack {double};

// If we had added "alias IntStack2 = Stack {int}"
// no additional copy would have been made (since we already
// have an parameterization of Stack {int} so it would
// be same as declaring IntStack2 an alias of IntStack

// Importing an external C function is straightforward
// here is an example of importing libc's printf:
extern fn int printf(char format, ...);

fn void main()
{
    IntStack stack;
    // Note that C3 uses zero initialization by default
    // so the 

Top issues

Discussions

Latest release

Version 0.8.6 v0.8.6 2026-11-11
Changes / improvements
- @asmname allows defining external names like @cname but without normal name mangling.
- Improved GfxKey mappings.
- Add the source-lib target type (and c3c source-lib command) to pack the C3 sources, C sources and headers of a project into a .c3l library.
- .c3l manifests without targets now work for all platforms, and may contain version, authors and langrev.
- fetch, vendor-fetch and project fetch now unpack libraries into a .c3l directory by default. Use --decompress=no to keep them compressed.
- fetch now verifies the downloaded library against the checksum (

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON