c2lang/c2compiler logo

c2lang/c2compiler

Free

the c2 programming language

FreeFree tier
Type
Open Source

About c2lang/c2compiler

C2 is a programming language that evolves from C, featuring a self-hosting compiler written in C2 itself. The compiler, available as the c2lang/c2compiler project on GitHub, emphasizes a bootstrap build process and a plugin system that allows compile-time modification of the abstract syntax tree (AST). It supports environment variable configuration for library and plugin paths, offers a built-in test suite, and is licensed under Apache-2.0. The project is actively maintained with over 800 stars and is intended for developers interested in system-level programming and language experimentation.

Key Features

Self-hosting compiler written in C2
Plugin system for compile-time AST modification
Bootstrap build process (make -C bootstrap, install_plugins.sh)
Environment variable configuration (C2_LIBDIR, C2_PLUGINDIR)
Unit test suite (./output/tester/tester test)
Apache-2.0 license

Pros & Cons

Pros
  • Self-hosting demonstrates language maturity and capability
  • Plugin system allows extensibility and custom compilation passes
  • Familiar C syntax with evolutionary improvements
Cons
  • Limited platform support (Linux and OSX only)
  • No stable releases or versioned packages
  • Relatively small community and ecosystem

Best For

Systems programming with an evolved C languageCompiler development and experimentationProjects requiring low-level control with modernized syntax

FAQ

What is C2?
C2 is an evolution of the C programming language, with a self-hosting compiler written in C2 itself. It aims to provide a modernized yet familiar development experience.
How do I install the C2 compiler?
Installation instructions are provided in the INSTALL.md document. The process involves setting environment variables C2_LIBDIR and C2_PLUGINDIR, then running a bootstrap with 'make -C bootstrap' and './install_plugins.sh'. The compiled output appears in the output/ directory.