Need help with c3c?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

463 Stars 30 Forks GNU Lesser General Public License v3.0 400 Commits 53 Opened issues


Compiler for the C3 language

Services available


Need anything else?

Contributors list

C3 Language

C3 is a C-like language trying to be "an incremental improvement over C" rather than a whole new language. C3 owes a lot to the ideas of the C2 language: to iterate on top of C without trying to be a whole new language.

C3 tries to be an alternative in the C/C++ niche: fast and close to the metal.

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.
  • Introduce some higher level conveniences where the value is great.

Example code

Create a

file with: ```c++ module hello_world; import std::io;

func void main() { io::printf("Hello, world!\n"); } ```

Make sure you have the standard libraries at either


Then run

c3c compile main.c3

The generated binary will be called


In what ways do C3 differ from C?

  • No mandatory header files
  • New semantic macro system
  • Module based name spacing
  • Subarrays (slices)
  • Compile time reflection
  • Enhanced compile time execution
  • Generics based on generic modules
  • "Result"-based zero overhead error handling
  • Defer
  • Value methods
  • Associated enum data
  • Built-in hooks for convenient string handling
  • No preprocessor
  • Less undefined behaviour and runtime checks in "safe" mode
  • Limited operator overloading to enable userland dynamic arrays
  • Optional pre and post conditions

Current status

It's possible to try out the current C3 compiler in the browser: – this is courtesy of the developer of Judge0.

Design work is still being done in the design draft here: If you have any suggestions, send a mail to [email protected], file an issue or discuss C3 on its dedicated Discord:

The compiler should compile on Linux, Windows (under Mingw or MSYS2) and MacOS, but needs some install documentation for Windows.

Due to its ABI compatibility with C, it's possible to mix C and C3 in the same project. As a demonstration, vkQuake was compiled with a small portion of the code converted to C3 and compiled with the c3c compiler:


(The vkFork is at

Todo / done

  • [x] For/while/do
  • [x]
  • [x] Structs
  • [x] Union
  • [x] Enums
  • [x] Value methods
  • [x] Compound literals
  • [x] Designated initalizers
  • [x] Slicing syntax
  • [x] Arrays and subarrays
  • [x] Modules
  • [x]
  • [x] Compile time assert with
  • [x] Compiler guiding
  • [x] C code calling by declaring methods
  • [x] Compile time variables
  • [x] Basic macros
  • [x] 4cc, 8cc, 2cc
  • [x] Enum type inference in switch/assignment
  • [x] Integer type inference
  • [x] Error type
  • [x] Failable error handling
  • [x]
    for conditional execution
  • [x]
    for error handling
  • [x] Implicit unwrap after
  • [x]
  • [x]
  • [x] 2s complement wrapping operators
  • [x] Labelled break / continue
  • [x]
  • [x] Expression blocks
  • [x] Do-without-while
  • [x] Foreach statement
  • [x] Templates
  • [x] Distinct types
  • [x] Built-in linking
  • [x] CT only macros evaluating to constants
  • [x] range initializers e.g.
    { [1..2] = 2 }
  • [x] Trailing body macros e.g.
    @foo(1, 100; int a) { bar(a); };
  • [x] Complex macros
  • [x] CT type constants
  • [x] Simd vector types partly implemented
  • [x] Subarray initializers
  • [ ] Anonymous structs
  • [ ] Complete C ABI conformance in progress
  • [ ] Debug info in progress
  • [ ] Virtual type in progress
  • [ ] Enum associated data support
  • [ ] Windows support in progress
  • [ ] All attributes in progress
  • [ ] Associative array literals
  • [ ] Reflection methods
  • [ ] LTO/ThinLTO setup
  • [ ]
    for globals
  • [ ] Escape macros
  • [ ] Implicit capturing macros
  • [ ] Bitstructs
  • [ ]
  • [ ]
  • [ ]
  • [ ] Pre-post conditions
  • [ ] Stdlib inclusion
  • [ ] String functions

What can you help with?

  • If you wish to contribute with ideas, please file issues on the c3docs: instead of the compiler.
  • Discuss the language on discord to help iron out syntax.
  • Interested in contributing to the stdlib? Please get in touch on Discord.
  • Are you a Windows dev? Please help make the compiler work on Windows!
  • Install instructions for other Linux and Unix variants are appreciated.

Installing on Ubuntu 20.10

  1. Make sure you have a C compiler that handles C11 and a C++ compiler, such as GCC or Clang. Git also needs to be installed.
  2. Install CMake:
    sudo apt install cmake
  3. Install LLVM 11:
    sudo apt-get install clang-11 zlib1g zlib1g-dev libllvm11 llvm-11 llvm-11-dev llvm-11-runtime liblld-11-dev liblld-11
  4. Clone the C3C github repository:
    git clone
  5. Enter the C3C directory
    cd c3c
  6. Create a build directory
    mkdir build
  7. Change directory to the build directory
    cd build
  8. Set up CMake build for debug:
    cmake -DLLVM_DIR=/usr/lib/llvm-11/cmake -DCMAKE_BUILD_TYPE=Debug ..
  9. Build:
    cmake --build .

You should now have a


You can try it out by running some sample code:

./c3c compile ../resources/examples/hash.c3

Building via Docker

You can build

using either an Ubuntu 18.04 or 20.04 container:
./ 18


to build through Ubuntu 20.04.

For a release build specify:

./ 20 Release


executable will be found under

Installing on OS X using Homebrew

  1. Install CMake:
    brew install cmake
  2. Install LLVM 11:
    brew install llvm
  3. Clone the C3C github repository:
    git clone
  4. Enter the C3C directory
    cd c3c
  5. Create a build directory
    mkdir build
  6. Change directory to the build directory
    cd build
  7. Set up CMake build for debug:
    cmake ..
  8. Build:
    cmake --build .

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.