The C3 Programming Language: An Evolution of C
Overview and Philosophy
C3 is a programming language designed to build upon the established syntax and semantics of C. It is positioned as an evolution rather than a revolution, targeting programmers who appreciate C but seek modern improvements. The language adheres to several core principles: data is considered inert, the "more is better" fallacy and "big ideas" are avoided, and higher-level conveniences are only introduced where they provide significant value. C3 draws its primary inspiration from the C2 language, seeking to iterate on C without becoming an entirely new entity.
Key Feature Differences from C
C3 introduces a variety of features that distinguish it from standard C while maintaining familiarity. Significant changes include the removal of mandatory header files and the preprocessor. In their place, C3 utilizes a module-based namespacing system and a new semantic macro system. The language also adds support for slices, compile-time reflection, enhanced compile-time execution, and generic programming via generic modules. Other notable additions include "Result"-based zero-overhead error handling, the defer keyword, value methods, and associated enum data. To improve reliability, C3 reduces undefined behavior and includes optional runtime checks in a dedicated "safe" mode.
Code Structure and Generics
The language supports advanced features like generics, which can be applied to entire modules. For example, a stack module can be parameterized with a placeholder type, allowing for the creation of specific instances such as IntStack or DoubleStack using aliases. C3 utilizes zero-initialization by default for variables. It also allows for the straightforward import of external C functions, such as printf from libc, ensuring interoperability with existing C ecosystems. The syntax supports dot-style calls for type methods, providing a modern interface for functional logic.
Current Development Status
The current stable version of the C3 compiler is 0.7.10. Development is currently focused on the 0.7.x release cycle, which prioritizes expanding the standard library, resolving bugs, and improving compile-time analysis. The compiler is verified to operate across several platforms, including Windows (x64), macOS (x64 and Aarch64), Linux (x64, x86, Aarch64, and Riscv), and OpenBSD. While some platforms like iOS and Android have limited or untested support for certain features like stack traces or threads, the core compiler remains highly portable.
Licensing and Contributions
The C3 project employs a dual-licensing model. In contrast, the standard library, examples, tests, and benchmarks are provided under the MIT license, allowing for broad reuse in other projects or even competing compilers. The development community is active on Discord, and contributors are encouraged to assist with the standard library, provide library bindings (such as SDL3), or report issues via GitHub.
