{"id":13606847,"url":"https://github.com/c3lang/c3c","last_synced_at":"2026-04-02T11:30:55.963Z","repository":{"id":36401143,"uuid":"199931048","full_name":"c3lang/c3c","owner":"c3lang","description":"Compiler for the C3 language","archived":false,"fork":false,"pushed_at":"2026-03-04T16:42:53.000Z","size":22272,"stargazers_count":5184,"open_issues_count":174,"forks_count":344,"subscribers_count":40,"default_branch":"master","last_synced_at":"2026-03-04T22:21:23.124Z","etag":null,"topics":["c3","compiler","language"],"latest_commit_sha":null,"homepage":"https://c3-lang.org","language":"C3","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/c3lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["c3lang"],"patreon":null,"open_collective":null,"ko_fi":"c3lang","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"polar":null,"custom":null}},"created_at":"2019-07-31T21:24:37.000Z","updated_at":"2026-03-04T20:51:20.000Z","dependencies_parsed_at":"2023-09-24T19:59:28.630Z","dependency_job_id":"33ba744b-a0f3-42e0-92a8-b927edebae5b","html_url":"https://github.com/c3lang/c3c","commit_stats":null,"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/c3lang/c3c","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c3lang%2Fc3c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c3lang%2Fc3c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c3lang%2Fc3c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c3lang%2Fc3c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/c3lang","download_url":"https://codeload.github.com/c3lang/c3c/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c3lang%2Fc3c/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30160022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"online","status_checked_at":"2026-03-06T02:00:08.268Z","response_time":250,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c3","compiler","language"],"created_at":"2024-08-01T19:01:12.971Z","updated_at":"2026-04-02T11:30:55.952Z","avatar_url":"https://github.com/c3lang.png","language":"C3","readme":"# C3 Language\n\nC3 is a programming language that builds on the syntax and semantics of the C language,\nwith the goal of evolving it while still retaining familiarity for C programmers.\n\nIt's an evolution, not a revolution: the C-like\nfor programmers who like C.\n\nPrecompiled binaries for the following operating systems are available:\n\n- Windows x64 [download](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-windows.zip), [install instructions](#installing-on-windows-with-precompiled-binaries).\n- Debian x64 [download](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-linux.tar.gz), [install instructions](#installing-on-debian-with-precompiled-binaries).\n- Ubuntu x86 [download](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-ubuntu-20.tar.gz), [install instructions](#installing-on-ubuntu-with-precompiled-binaries).\n- MacOS Arm64 [download](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-macos.zip), [install instructions](#installing-on-macos-with-precompiled-binaries).\n- OpenBSD x64 [download](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-openbsd.tar.gz), [install instructions](#installing-on-openbsd-with-precompiled-binaries).\n\nThe manual for C3 can be found at [www.c3-lang.org](http://www.c3-lang.org).\n\n![vkQuake](https://github.com/c3lang/c3c/blob/master/resources/images/vkQuake.png?raw=true)\n\nThanks 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)\n\nA non-curated list of user written projects and other resources can be found [here](https://github.com/c3lang/c3-showcase).\n\n### Design Principles\n- Procedural \"get things done\"-type of language.\n- Try to stay close to C - only change what's really necessary.\n- C ABI compatibility and excellent C integration.\n- Learning C3 should be easy for a C programmer.\n- Data is inert.\n- Avoid \"big ideas\" \u0026 the \"more is better\" fallacy.\n- Introduce some higher level conveniences where the value is great.\n\nC3 owes its inspiration to the [C2 language](http://c2lang.org): to iterate on top of C without trying to be a\nwhole new language.\n\n### Example code\n\nThe following code shows [generics](https://c3-lang.org/generic-programming/generics/) (more examples can be found at https://c3-lang.org/language-overview/examples/).\n\n```c3\nmodule stack \u003cType\u003e;\n// Above: the parameterized type is applied to the entire module.\n\nstruct Stack\n{\n    usz capacity;\n    usz size;\n    Type* elems;\n}\n\n// The type methods offers dot syntax calls,\n// so this function can either be called\n// Stack.push(\u0026my_stack, ...) or\n// my_stack.push(...)\nfn void Stack.push(Stack* this, Type element)\n{\n    if (this.capacity == this.size)\n    {\n        this.capacity *= 2;\n        if (this.capacity \u003c 16) this.capacity = 16;\n        this.elems = realloc(this.elems, Type.sizeof * this.capacity);\n    }\n    this.elems[this.size++] = element;\n}\n\nfn Type Stack.pop(Stack* this)\n{\n    assert(this.size \u003e 0);\n    return this.elems[--this.size];\n}\n\nfn bool Stack.empty(Stack* this)\n{\n    return !this.size;\n}\n```\n\nTesting it out:\n\n```c3\nimport stack;\n\n// Define our new types, the first will implicitly create\n// a complete copy of the entire Stack module with \"Type\" set to \"int\"\nalias IntStack = Stack {int};\n// The second creates another copy with \"Type\" set to \"double\"\nalias DoubleStack = Stack {double};\n\n// If we had added \"alias IntStack2 = Stack {int}\"\n// no additional copy would have been made (since we already\n// have an parameterization of Stack {int} so it would\n// be same as declaring IntStack2 an alias of IntStack\n\n// Importing an external C function is straightforward\n// here is an example of importing libc's printf:\nextern fn int printf(char* format, ...);\n\nfn void main()\n{\n    IntStack stack;\n    // Note that C3 uses zero initialization by default\n    // so the above is equivalent to IntStack stack = {};\n\n    stack.push(1);\n    // The above can also be written IntStack.push(\u0026stack, 1);\n\n    stack.push(2);\n\n    // Prints pop: 2\n    printf(\"pop: %d\\n\", stack.pop());\n    // Prints pop: 1\n    printf(\"pop: %d\\n\", stack.pop());\n\n    DoubleStack dstack;\n    dstack.push(2.3);\n    dstack.push(3.141);\n    dstack.push(1.1235);\n    // Prints pop: 1.123500\n    printf(\"pop: %f\\n\", dstack.pop());\n}\n```\n\n### In what ways does C3 differ from C?\n\n- No mandatory header files\n- New semantic macro system\n- Module based name spacing\n- Slices\n- Operator overloading\n- Compile time reflection\n- Enhanced compile time execution\n- Generics based on generic modules\n- \"Result\"-based zero overhead error handling\n- Defer\n- Value methods\n- Associated enum data\n- No preprocessor\n- Less undefined behaviour and added runtime checks in \"safe\" mode\n- Limited operator overloading to enable userland dynamic arrays\n- Optional pre and post conditions\n\n### Current status\n\nThe current stable version of the compiler is **version 0.7.11**.\n\nThe upcoming 0.7.x releases will focus on expanding the standard library,\nfixing bugs and improving compile time analysis.\nFollow the issues [here](https://github.com/c3lang/c3c/issues).\n\nIf you have suggestions on how to improve the language, either [file an issue](https://github.com/c3lang/c3c/issues)\nor discuss C3 on its dedicated Discord: [https://discord.gg/qN76R87](https://discord.gg/qN76R87).\n\nThe compiler is currently verified to compile on Linux, OpenBSD, Windows and MacOS.\n\n**Support matrix**\n\n| Platform                 | Native C3 compiler available? | Target supported        | Stack trace | Threads  | Sockets  | Inline asm |\n|--------------------------|-------------------------------|-------------------------|-------------|----------|----------|------------|\n| Win32 x64                | Yes                           | Yes + cross compilation | Yes         | Yes      | Yes      | Yes*       |\n| Win32 Aarch64            | Untested                      | Untested                | Untested    | Untested | Untested | Yes*       |\n| MacOS x64                | Yes                           | Yes + cross compilation | Yes         | Yes      | Yes      | Yes*       |\n| MacOS Aarch64            | Yes                           | Yes + cross compilation | Yes         | Yes      | Yes      | Yes*       |\n| iOS Aarch64              | No                            | Untested                | Untested    | Yes      | Yes      | Yes*       |\n| Android Aarch64          | No                            | Untested                | Untested    | Untested | Untested | Yes*       |\n| Android x64              | No                            | Untested                | Untested    | Untested | Untested | Yes*       |\n| Linux x86                | Yes                           | Yes                     | Yes         | Yes      | Yes      | Yes*       |\n| Linux x64                | Yes                           | Yes                     | Yes         | Yes      | Yes      | Yes*       |\n| Linux Aarch64            | Yes                           | Yes                     | Yes         | Yes      | Yes      | Yes*       |\n| Linux Riscv32            | Yes                           | Yes                     | Yes         | Yes      | Yes      | Untested   |\n| Linux Riscv64            | Yes                           | Yes                     | Yes         | Yes      | Yes      | Untested   |\n| ELF freestanding x86     | No                            | Untested                | No          | No       | No       | Yes*       |\n| ELF freestanding x64     | No                            | Untested                | No          | No       | No       | Yes*       |\n| ELF freestanding Aarch64 | No                            | Untested                | No          | No       | No       | Yes*       |\n| ELF freestanding Riscv64 | No                            | Untested                | No          | No       | No       | Untested   |\n| ELF freestanding Riscv32 | No                            | Untested                | No          | No       | No       | Untested   |\n| ELF freestanding Xtensa* | No                            | Untested                | No          | No       | No       | Untested   |\n| FreeBSD x86              | Untested                      | Untested                | No          | Yes      | Untested | Yes*       |\n| FreeBSD x64              | Untested                      | Untested                | No          | Yes      | Untested | Yes*       |\n| NetBSD x86               | Untested                      | Untested                | No          | Yes      | Untested | Yes*       |\n| NetBSD x64               | Untested                      | Untested                | No          | Yes      | Untested | Yes*       |\n| OpenBSD x86              | Untested                      | Untested                | No          | Yes      | Untested | Yes*       |\n| OpenBSD x64              | Yes*                          | Yes                     | Yes*        | Yes      | Untested | Yes*       |\n| MCU x86                  | No                            | Untested                | No          | No       | No       | Yes*       |\n| Wasm32                   | No                            | Yes                     | No          | No       | No       | No         |\n| Wasm64                   | No                            | Untested                | No          | No       | No       | No         |\n\n*\\* Inline asm is still a work in progress*\u003cbr\u003e\n*\\* OpenBSD 7.7 is the only tested version*\u003cbr\u003e\n*\\* OpenBSD has limited stacktrace, needs to be tested further*\u003cbr\u003e\n*\\* Xtensa support is enabled by compiling with `-DXTENSA_ENABLE`. The [espressif llvm fork](https://github.com/espressif/llvm-project) is recommended for best compatibility*\n\nMore platforms will be supported in the future.\n\n#### What can you help with?\n\n- If you wish to contribute with ideas, please file issues or discuss on Discord.\n- Interested in contributing to the stdlib? Please get in touch on Discord.\n- Compilation instructions for other Linux and Unix variants are appreciated.\n- Would you like to contribute bindings to some library? It would be nice to have support for SDL3 and more. If you have created some bindings, please submit them to https://github.com/c3lang/vendor.\n- Build something with C3 and show it off and give feedback. The language is still open for significant tweaks.\n- Start work on the C -\u003e C3 converter which takes C code and does a \"best effort\" to translate it to C3. The first version only needs to work on C headers.\n- Do you have some specific area you have deep knowledge of and could help make C3 even better at doing? File or comment on issues.\n\n### Installing\n\nThis installs the latest prerelease build, as opposed to the latest released version.\n\n#### Installing on Windows with precompiled binaries\n1. Download the zip file: [https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-windows.zip](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-windows.zip)\n   (debug version [here](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-windows-debug.zip))\n2. Unzip exe and standard lib.\n3. Run `c3c.exe`.\n\n#### Installing on Windows with the install script\n\nOpen a PowerShell terminal (you may need to run it as an administrator) and run the following command:\n```bash\niwr -useb https://raw.githubusercontent.com/c3lang/c3c/refs/heads/master/install/install.ps1 | iex\n```\nThe script will inform you once the installation is successful and add the `~/.c3` directory to your PATH, which will allow you to run the c3c command from any location.\n\nYou can choose another version with option `C3_VERSION`.\nFor example, you can force the installation of the 0.7.4 version:\n```bash\n$env:C3_VERSION='0.7.4'; powershell -ExecutionPolicy Bypass -Command \"iwr -useb https://raw.githubusercontent.com/c3lang/c3c/refs/heads/master/install/install.ps1 | iex\"\n```\n\n**(Optional)** If you don't have Visual Studio 17 installed, you can run the `c3c fetch windows-sdk` command which will download the necessary files to compile on Windows.\n\n\n#### Installing on Debian with precompiled binaries\n1. Download tar file: [https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-linux.tar.gz](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-linux.tar.gz)\n   (debug version [here](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-linux-debug.tar.gz))\n2. Unpack executable and standard lib.\n3. Run `./c3c`.\n\n#### Installing on Debian with the install script\n\nOpen a terminal and run the following command:\n```bash\ncurl -fsSL https://raw.githubusercontent.com/c3lang/c3c/refs/heads/master/install/install.sh | bash\n```\nThe C3 compiler will be installed, and the script will also update your ~/.bashrc to include `~/.c3` in your PATH, allowing you to invoke the c3c command from anywhere. You might need to restart your terminal or source your shell for the changes to take effect.\n\nYou can choose another version with option `C3_VERSION`.\nFor example, you can force the installation of the 0.7.4 version:\n```bash\ncurl -fsSL https://raw.githubusercontent.com/c3lang/c3c/refs/heads/master/install/install.sh | C3_VERSION=0.7.4 bash\n```\n\n#### Installing on Ubuntu with precompiled binaries\n1. Download tar file: [https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-ubuntu-20.tar.gz](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-ubuntu-20.tar.gz)\n   (debug version [here](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-ubuntu-20-debug.tar.gz))\n2. Unpack executable and standard lib.\n3. Run `./c3c`.\n\n#### Installing on MacOS with precompiled binaries\n1. Make sure you have XCode with command line tools installed.\n2. Download the zip file: [https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-macos.zip](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-macos.zip)\n   (debug version [here](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-macos-debug.zip))\n3. Unzip executable and standard lib.\n4. Run `./c3c`.\n\n(*Note that there is a known issue with debug symbol generation on MacOS 13, see [issue #1086](https://github.com/c3lang/c3c/issues/1086))\n\n#### Installing on OpenBSD with precompiled binaries\n1. Download tar file: [https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-openbsd.tar.gz](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-openbsd.tar.gz)\n   (debug version [here](https://github.com/c3lang/c3c/releases/download/latest-prerelease-tag/c3-openbsd-debug.tar.gz))\n2. Unpack executable and standard lib.\n3. Run `./c3c`.\n\n(*Note that this is specifically for OpenBSD 7.7, running it on any other version is prone to ABI breaks)\n\n#### Installing on Arch Linux\nArch includes c3c in the official 'extra' repo. It can be easily installed the usual way:\n\n```sh\nsudo pacman -S c3c\n# or paru -S c3c\n# or yay -S c3c\n# or aura -A c3c\n```\n\nThere is also an AUR package for the c3c compiler : [c3c-git](https://aur.archlinux.org/packages/c3c-git).\n\nYou can use your AUR package manager:\n```sh\nparu -S c3c-git\n# or yay -S c3c-git\n# or aura -A c3c-git\n```\n\nOr clone it manually:\n```sh\ngit clone https://aur.archlinux.org/c3c-git.git\ncd c3c-git\nmakepkg -si\n```\n\n#### Installing on Fedora\n\nC3 is available as a community maintained COPR package for Fedora.  \nTo install via dnf:\n```sh\nsudo dnf copr enable sisyphus1813/c3\nsudo dnf install c3\n```\n\n#### Installing via Nix\n\nYou can access `c3c` via [flake.nix](./flake.nix), which will contain the latest commit of the compiler. To add `c3c` to your `flake.nix`, do the following:\n```nix\n{\n  inputs = {\n    nixpkgs.url = \"github:nixos/nixpkgs?ref=nixpkgs-unstable\";\n    flake-utils.url = \"github:numtide/flake-utils\";\n    c3c.url = \"github:c3lang/c3c\";\n    # Those are desired if you don't want to copy extra nixpkgs\n    c3c.inputs = {\n      nixpkgs.follows = \"nixpkgs\";\n      flake-utils.follows = \"flake-utils\";\n    };\n  };\n\n  outputs = { self, ... } @ inputs: inputs.flake-utils.lib.eachDefaultSystem (system:\n    let\n      pkgs = import inputs.nixpkgs { inherit system; };\n      c3c = inputs.c3c.packages.${system}.c3c;\n    in\n    {\n      devShells.default = pkgs.mkShell {\n        buildInputs = [\n          pkgs.c3c\n        ];\n      };\n    }\n  );\n}\n```\n\n### Installing on Gentoo\n\n`c3c` is available in the [Gentoo GURU overlay](https://wiki.gentoo.org/wiki/Project:GURU).\n\nEnable and sync the GURU repository (if not already done):\n\n```sh\nsudo eselect repository enable guru\nsudo emaint sync -r guru\n```\n\nInstall `c3c` with:\n\n```sh\nsudo emerge -av dev-lang/c3c\n```\n\n* The compiler binary is installed to `/usr/bin/c3c`.\n* The standard library is installed to `/usr/lib/c3`.\n\nFor Gentoo-specific issues, please use the [Gentoo Bugzilla](https://bugs.gentoo.org/) (Product: *GURU*).\n\n#### Building via Docker\n\nYou can build `c3c` using an Ubuntu container. By default, the script will build through Ubuntu 22.04. You can specify the version by passing the `UBUNTU_VERSION` environment variable.\n\n```\nUBUNTU_VERSION=20.04 ./build-with-docker.sh\n```\n\nSee the `build-with-docker.sh` script for more information on other configurable environment variables.\n\n#### Installing on OS X using Homebrew\n\n1. Install [Homebrew](https://brew.sh/)\n2. Install LLVM 19+: `brew install llvm`\n3. Install lld: `brew install lld`\n4. Install CMake: `brew install cmake`\n5. Clone the C3C github repository: `git clone https://github.com/c3lang/c3c.git`\n6. Enter the C3C directory `cd c3c`.\n7. Set up CMake build for debug: `cmake -B build -S .`\n8. Build: `cmake --build build`\n9. Change directory to the build directory `cd build`\n\n#### Installing on Windows using Scoop\n\nc3c is included in 'Main' bucket.\n\n```sh\nscoop install c3\n```\n\n#### Getting started with a \"hello world\"\n\nCreate a `main.c3` file with:\n```c3\nmodule hello_world;\nimport std::io;\n\nfn void main()\n{\n   io::printn(\"Hello, world!\");\n}\n```\n\nMake sure you have the standard libraries at either `../lib/std/` or `/lib/std/`.\n\nThen run\n```sh\nc3c compile main.c3\n```\n\nThe generated binary will by default be named after the module that contains the main\nfunction. In our case that is `hello_world`, so the resulting binary will be\ncalled `hello_world` or `hello_world.exe`depending on platform.\n\n### Compiling\n\n#### Compiling on Windows\n\n1. Make sure you have Visual Studio 17 2022 installed or alternatively install the \"Buildtools for Visual Studio\" (https://aka.ms/vs/17/release/vs_BuildTools.exe) and then select \"Desktop development with C++\"\n2. Install CMake\n3. Clone the C3C github repository: `git clone https://github.com/c3lang/c3c.git`\n4. Enter the C3C directory: `cd c3c`.\n5. Set up the CMake build: `cmake --preset windows-vs-2022-release`\n6. Build: `cmake --build --preset windows-vs-2022-release`\n\nYou should now have a `c3c` executable in `build\\Release`.\n\nYou can try it out by running some sample code: `c3c.exe compile ../../resources/examples/hash.c3`\n\nBuilding `c3c` using Visual Studio Code is also supported when using the `CMake Tools` extension. Simply select the `Windows x64 Visual Studio 17 2022` configure preset and build.\n\n*Note that if you run into linking issues when building, make sure that you are using the latest version of VS17.*\n\n#### Compiling on Windows (Debug)\n\nDebug build requires a different set of LLVM libraries to be loaded for which a separate CMake configuration is used to avoid conflicts.\n1. Configure: `cmake --preset windows-vs-2022-debug`\n2. Build: `cmake --build --preset windows-vs-2022-debug`\n\nYou should now have a `c3c` executable in `build-debug\\Debug`.\n\n#### Compiling on Ubuntu 24.04 LTS\n\n1. 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.\n2. Install LLVM 18 `sudo apt-get install cmake git clang zlib1g zlib1g-dev libllvm18 llvm llvm-dev llvm-runtime liblld-dev liblld-18 libpolly-18-dev`. If you're using Ubuntu 25.04, also install `libpolly-20-dev`.\n3. Clone the C3C github repository: `git clone https://github.com/c3lang/c3c.git`\n4. Enter the C3C directory `cd c3c`.\n5. Set up CMake build: `cmake -B build -S .`\n6. Build: `cmake --build build`\n7. Change directory to the build directory `cd build`\n\nYou should now have a `c3c` executable.\n\nYou can try it out by running some sample code: `./c3c compile ../resources/examples/hash.c3`\n\n\n#### Compiling on Void Linux\n\n1. As root, ensure that all project dependencies are installed: `xbps-install git cmake llvm17 llvm17-devel lld17-devel libcurl-devel ncurses-devel zlib-devel libzstd-devel libxml2-devel`\n2. Clone the C3C repository: `git clone https://github.com/c3lang/c3c.git`\n    - If you only need the latest commit, you may want to make a shallow clone instead: `git clone https://github.com/c3lang/c3c.git --depth=1`\n3. Enter the directory: `cd c3c`\n4. Create the CMake build cache: `cmake -B build -S .`\n5. Build: `cmake --build build`\n6. Enter the build directory: `cd build`\n\nYour c3c executable should have compiled properly. You may want to test it: `./c3c compile ../resources/examples/hash.c3`\nFor a system-wide installation, run the following as root: `cmake --install .`\n\n\n#### Compiling on Fedora\n\n1. Install required project dependencies: `dnf install cmake clang git llvm llvm-devel lld lld-devel ncurses-devel`\n2. Optionally, install additional dependencies: `dnf install libcurl-devel zlib-devel libzstd-devel libxml2-devel libffi-devel`\n3. Clone the C3C repository: `git clone https://github.com/c3lang/c3c.git`\n    - If you only need the latest commit, you may want to make a shallow clone: `git clone https://github.com/c3lang/c3c.git --depth=1`\n4. Enter the C3C directory: `cd c3c`\n5. Create the CMake build cache. The Fedora repositories provide `.so` libraries for lld, so you need to set the C3_LINK_DYNAMIC flag: `cmake -B build -S . -DC3_LINK_DYNAMIC=1`\n6. Build the project: `cmake --build build`\n7. Enter the build directory: `cd build`\n\nThe c3c binary should be created in the build directory. You can try it out by running some sample code: `./c3c compile ../resources/examples/hash.c3`\n\n#### Compiling on Arch Linux\n\n1. Install required project dependencies: `sudo pacman -S curl lld llvm-libs clang cmake git libedit llvm libxml2`\n2. Clone the C3C repository: `git clone https://github.com/c3lang/c3c.git`\n    - If you only need the latest commit, you may want to make a shallow clone: `git clone https://github.com/c3lang/c3c.git --depth=1`\n3. Enter the C3C directory: `cd c3c`\n4. Create the CMake build cache:\n```bash\ncmake -B build \\\n    -D C3_LINK_DYNAMIC=ON \\\n    -D CMAKE_BUILD_TYPE=Release\n```\n5. Build the project: `cmake --build build`.\n\nAfter compilation, the `c3c` binary will be located in the `build` directory. You can test it by compiling an example: `./build/c3c compile resources/examples/ls.c3`.\n\n6. To install the compiler globally: `sudo cmake --install build`\n\n#### Compiling on NixOS\n\n1. Enter nix shell, by typing `nix develop` in root directory\n2. Configure cmake via `cmake . -Bbuild $=C3_CMAKE_FLAGS`. Note: passing `C3_CMAKE_FLAGS` is needed in due to generate `compile_commands.json` and find missing libs.\n4. Build it `cmake --build build`\n5. Test it out: `./build/c3c -V`\n6. If you use `clangd` lsp server for your editor, it is recommended to make a symbolic link to `compile_command.json` in the root: `ln -s ./build/compile_commands.json compile_commands.json`\n\n#### Compiling on other Linux / Unix variants\n\n1. Install CMake.\n2. Install or compile LLVM and LLD *libraries* (version 19+ or higher)\n3. Clone the C3C github repository: `git clone https://github.com/c3lang/c3c.git`\n4. Enter the C3C directory `cd c3c`.\n5. Set up CMake build for debug: `cmake -B build -S .`. At this point you may need to manually\nprovide the link path to the LLVM CMake directories, e.g. `cmake -B build -S . -DLLVM_DIR=/usr/local/opt/llvm/lib/cmake/llvm/`\n6. Build: `cmake --build build`\n7. Change directory to the build directory `cd build`\n\n*A note on compiling for Linux/Unix/MacOS: to be able to fetch vendor libraries\nlibcurl is needed. The CMake script should detect it if it is available. Note that\nthis functionality is non-essential and it is perfectly fine to use the compiler without it.*\n\n#### Licensing\n\nUnless specified otherwise, the code in this repository is MIT licensed.\nThe exception is the compiler source code (the source code under `src`),\nwhich is licensed under LGPL 3.0.\n\nThis means you are free to use all parts of standard library,\ntests, benchmarks, grammar, examples and so on under the MIT license, including\nusing those libraries and tests if you build your own C3 compiler.\n\n#### Editor plugins\n\nEditor plugins can be found at https://github.com/c3lang/editor-plugins.\n\n#### Contributing unit tests\n\n1. Write the test, either adding to existing test files in `/test/unit/` or add\n   a new file. (If testing the standard library, put it in the `/test/unit/stdlib/` subdirectory).\n2. Make sure that the test functions have the `@test` attribute.\n3. Run tests and see that they pass. (Recommended settings: `c3c compile-test -O0 test/unit`.\n   - in this example `test/unit/` is the relative path to the test directory, so adjust as required)\n4. Make a pull request for the new tests.\n\n## Thank yous\n\nA huge **THANK YOU** goes out to all contributors and sponsors.\n\nA special thank you to sponsors [Zack Puhl](https://github.com/NotsoanoNimus) and [konimarti](https://github.com/konimarti) for going the extra mile.\n\nAnd honorable mention goes to past sponsors:\n[Ygor Pontelo](https://github.com/ygorpontelo), [Simone Raimondi](https://github.com/SRaimondi),\n[Jan Válek](https://github.com/jan-valek), [Pierre Curto](https://github.com/pierrec),\n[Caleb-o](https://github.com/Caleb-o) and [devdad](https://github.com/devdad)\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=c3lang/c3c\u0026type=Date)](https://www.star-history.com/#c3lang/c3c\u0026Date)\n","funding_links":["https://github.com/sponsors/c3lang","https://ko-fi.com/c3lang"],"categories":["C","Uncategorized","C3","\u003ca name=\"C\"\u003e\u003c/a\u003eC"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc3lang%2Fc3c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fc3lang%2Fc3c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc3lang%2Fc3c/lists"}