1
2
Fork
You've already forked ccc
0
Contemporary C89 Compiler
  • Roff 100%
2026年06月04日 15:21:48 +09:00
doc doc: add 8_Error_Reference.md 2026年06月04日 13:03:59 +09:00
ccc.1 doc: rewrite man page 2026年05月06日 15:18:08 +09:00
CONTRIBUTING.md doc: add CONTRIBUTING.md 2026年03月26日 11:19:17 +09:00
LICENSE feat: add basics 2025年06月22日 23:58:31 +09:00
README.md doc: update table of contents 2026年06月04日 15:21:48 +09:00

CCC - Contemporary C89 Compiler

ccc-<arch> [-DUv] files...

Overview

WARNING This project is a work in progress.

ccc is a modernized C compiler based on the ISO/IEC 9899:1990 (C89) standard. It enforces strict typing and structural clarity by stripping away legacy artifacts and applying modern programming practices at the compiler level. It generates standard ELF object files with a built-in startup routine and no runtime overhead.

Key features:

  • Header Purity: Definitions in .h files are strictly prohibited; headers are declaration-only.
  • Built-in crt0: Automatic startup routine covering _start, argument handling, and exit syscalls.
  • Column Tracking: Error diagnostics include exact column positions.

Legacy removals:

  • Syntax: Trigraphs and K&R-style function definitions are not supported.
  • Implicit Rules: Implicit int types and implicit function declarations are abolished.
  • Keywords: auto and register are removed from the grammar.
  • Limits: The 6-character external identifier significance limit is removed.

Options

Option Description
-Dmacro[=value] Define macro with optional value
-Umacro Undefine macro
-v Display version information

Installation

Requirements:

  • POSIX-compliant Make
  • C compiler with ISO/IEC 9899:1990 (C89) support
  • C standard library with IEEE Std 1003.1-2001 (POSIX.1-2001) support
  • elf.h development header

Before building, set the ARCH variable in config.mk to the desired target architecture. The default value is aarch64.

Build from source:

$ git clone https://codeberg.org/woohyun/ccc.git
$ cd ccc
$ make
$ make test
# make install

To invoke ccc without specifying the architecture each time, create a symbolic link named ccc pointing to the installed binary for the host architecture:

# ln -s /usr/local/bin/casm-aarch64 /usr/local/bin/casm

Example

This code prints "Hello, world!":

#include <stdio.h>
int
main(void)
{
	puts("Hello, world!");
	return 0;
}

To compile, link, and execute:

$ ccc hello.c
$ ld -o hello hello.o
$ ./hello
Hello, world!

Documentation

See the following documents for details:

Language_Specification Lexical_Rules Types_and_Qualifiers Expressions_and_Operators Statements_and_Control_Flow Preprocessor Compiler_Reference Error_Reference

License

CCC by Woohyun Joh is released into the public domain under CC0 1.0 Universal.

You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.