- Roff 100%
| doc | doc: add 8_Error_Reference.md | |
| ccc.1 | doc: rewrite man page | |
| CONTRIBUTING.md | doc: add CONTRIBUTING.md | |
| LICENSE | feat: add basics | |
| README.md | doc: update table of contents | |
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
.hfiles 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
inttypes and implicit function declarations are abolished. - Keywords:
autoandregisterare 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.hdevelopment 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.