Compiler for the Deterministic C language.
  • C++ 93%
  • TypeScript 3.3%
  • Python 2.1%
  • Makefile 0.5%
  • Zig 0.4%
  • Other 0.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-20 16:59:20 +02:00
.vscode Initial Commit 2026-06-04 22:14:42 +02:00
compiler fix(sema): support direct pack indexing on variadic structs 2026-09-20 13:49:59 +02:00
dccd feat(dccd): show evaluated size in sizeof hover 2026-09-16 21:09:44 +02:00
dcdoc feat(dcdoc): html site output, stdlib chapter scoping, code-mode signature rendering 2026-09-20 16:59:20 +02:00
debian chore: bump version sites to 0.3.0 2026-09-11 16:30:57 +02:00
docs spec: document doc-comment system as section 20 2026-09-18 22:23:04 +02:00
driver refactor: rewrite the driver model to be more symmethric and extensible 2026-09-16 13:29:59 +02:00
integrations/gitea feat: offline Gitea syntax highlighting for DC 2026-09-11 18:15:28 +02:00
libdcext feat: add assert runtime wiring compiler bounds checks 2026-09-16 20:00:57 +02:00
mk feat: resolve libdcext includes in dccd from a baked install prefix 2026-09-13 18:29:29 +02:00
packaging feat: PKGBUILD for arch linux 2026-09-06 11:16:07 +02:00
tests feat(dcdoc): html site output, stdlib chapter scoping, code-mode signature rendering 2026-09-20 16:59:20 +02:00
vscode feat: document flag view any and module assembly 2026-09-14 12:33:47 +02:00
zig refactor: rewrite the driver model to be more symmethric and extensible 2026-09-16 13:29:59 +02:00
.clang-format Initial Commit 2026-06-04 22:14:42 +02:00
.clang-tidy Initial Commit 2026-06-04 22:14:42 +02:00
.dockerignore chore: bump version to v0.2.0 2026-09-07 16:00:29 +02:00
.gitignore feat: cross-compile dcc/dccd for Windows with LLVM backend and MSI packaging 2026-09-06 21:50:59 +02:00
build.zig refactor: update project metadata 2026-09-06 11:19:54 +02:00
build.zig.zon chore: bump version sites to 0.3.0 2026-09-11 16:30:57 +02:00
CHANGELOG.md docs: release v0.3.0 2026-09-11 17:33:24 +02:00
flake.lock feat: add Nix flake support 2026-09-06 11:19:46 +02:00
flake.nix feat: add typst to flake build inputs and dev shell 2026-09-20 13:49:59 +02:00
GNUmakefile feat(dcdoc): install dcdoc binary with make install 2026-09-20 14:19:50 +02:00
LICENSE refactor: update project metadata 2026-09-06 11:19:54 +02:00
README.md feat: resolve libdcext includes in dccd from a baked install prefix 2026-09-13 18:29:29 +02:00
TODO feat: document flag view any and module assembly 2026-09-14 12:33:47 +02:00

dc

dc is a small systems language with an LLVM backend, built with a freestanding-first mindset: no hosted OS, no libc, and no implicit runtime are assumed unless you ask for them. It targets the space C/C++ usually occupies, but without C's implicit conversions and without pulling in a C++-style OOP type system to get generics and basic ergonomics.

The core design choices follow from that:

  • No implicit conversions. Integer literals are typed from context; a value that doesn't fit its target type is a compile error, not silent truncation.
  • No constructors, inheritance, or member functions on structs. Structs are plain data; behavior is free functions, called using UFCS (p.length() instead of length(p)) when convenient.
  • Templates, constraints (if Concept(T)), and variadics give you generic code without runtime cost or a class hierarchy.
  • Codegen-affecting choices (stack protector, frame pointer, calling convention, alignment, sections, atomics) are explicit attributes and driver flags, not compiler heuristics.
  • Minimal implicit control flow. There is no operator overloading or destructors, all control flow transfers are explicit with call syntax, compiler-aided cleanup is available via the defer keyword.

See docs/spec.md for the language reference. It's a living draft, the implementation moves faster than the document, but I try to keep it in sync after every major feature addition or a large number of smaller improvements.

Status

Solo project, pre-release. The language, ABI, and CLI surface are all expected to keep moving. Treat anything here as subject to change.

Installation

Debian

Prebuilt Debian packages are available from GitHub Releases.

Download the appropriate .deb package and install it with:

sudo apt install ./dcc_*.deb

Windows

Prebuilt Windows MSI installers (dcc-<version>-x86_64.msi) are available from GitHub Releases. Run the installer to set up dcc, dccd, and standard library headers.

Arch Linux

Arch users can build the package using the provided PKGBUILD:

git clone https://github.com/Personne-admin/dcc.git
cd dcc/packaging/arch
makepkg -si

Nix / NixOS

dcc provides a Nix flake and can be installed directly from GitHub:

nix profile install github:Personne-admin/dcc

For development, enter the provided development shell with:

nix develop github:Personne-admin/dcc

On NixOS, the flake package can also be added directly to environment.systemPackages.

From source

On other distributions, dcc can be built directly from source. A C++26-capable Clang with module support, LLVM, Python 3, and GNU Make are required.

See the build instructions below.

Building the compiler

Build dependencies: a C++26-capable clang with module support, LLVM, GNU Make.

make            # builds the driver, dccd, and libdcext
make test       # builds and runs the test suite
make install    # installs dcc, dccd, and libdcext to PREFIX (default /usr/local)

Warning: If you wish to correctly install into a custom PREFIX, set the environment variable for both the make and make install invocations to ensure that the compiler has correct defaults.

ENABLE_LLVM, ENABLE_ASAN, and BUILD_TYPE are overridable via make VAR=value; see GNUmakefile for the full list of targets.

Using dc from a Zig build system

As there is currently no custom build tool for dc projects, a DCC SDK is provided for the Zig build system for use in any user projects. In order to use DCC from a project which uses Zig build, add the SDK to it:

zig fetch --save git+https://github.com/Personne-admin/dcc.git

then in build.zig add dc sources:

const dcc = @import("dcc");

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const artifact = dcc.sdk.compile(b, .{
        .name = "hello",
        .source_file = b.path("src/main.dc"),
        .target = target,
        .optimize = optimize,
    });

    b.installFile(artifact.output_file, "bin/hello");
}

dcc.sdk.CompileOptions mirrors the driver's flags directly: libdcext, position_independent_code, no_red_zone, no_stack_protector, code_model, bounds_check, and so on;
Supported targets are x86_64-elf, x86-elf, x86_64-coff, and x86-coff;
dc doesn't assume a hosted OS, so Zig's linux and freestanding os tags both map to the plain ELF target.

Freestanding by default

A dc program has no implicit prelude: no allocator, no I/O, nothing assumed about the host. This is intentional, dc is meant to be as usable for a kernel or a microcontroller as for a regular userspace binary.

libdcext is the opt-in hosted standard library. It's only linked in and its prelude only injected when you pass -flibdcext to the driver (or set .libdcext = true in the Zig SDK options). Without it, you get exactly the language and core::* compiler intrinsics, nothing else.

Tooling

dccd is the language server: completion, formatting, semantic tokens, inlay hints, and workspace symbols, all over LSP.

The vscode/ extension (DC Language Support) wraps dccd for syntax highlighting and editor integration in VS Code. Neovim support is planned, built on the same dccd server.

License

GPLv3 or later. See LICENSE.